View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0006175 | OXID eShop (all versions) | 4.08. Cache | public | 2015-06-20 17:37 | 2024-02-07 11:34 |
Reporter | m4r73n | Assigned To | |||
Priority | normal | Severity | minor | Reproducibility | always |
Status | acknowledged | Resolution | open | ||
Product Version | 4.9.4 / 5.2.4 | ||||
Summary | 0006175: Concatenation of string and bool leads to wrong cache hits in oxConfig::getDir() | ||||
Description | In the *function getDir()* of *oxConfig* the $sCacheKey is generated by $sCacheKey = $sPath . "_{$blIgnoreCust}{$blAbsolute}"; However, both $blIgnoreCust and $blAbsolute are booleans, and casting them to a string yields: - "1" if true - "" if false Thus, $blIgnoreCust = true, $blAbsolute = true gives: _11 and $blIgnoreCust = true, $blAbsolute = false gives: _1 and $blIgnoreCust = false, $blAbsolute = true gives: _1 and $blIgnoreCust = false, $blAbsolute = false gives: _ As you can easily see, the two cases where one of the variables is true and the other is false lead to the same $sCacheKey, which leads erroneous cache hits. This bug can easily be fixed by casting the bools to non-empty values, e.g. to "1" for true and "0" for false. | ||||
Tags | Performance and Caching Rework | ||||
Attached Files | |||||
Theme | All | ||||
Browser | Not defined | ||||
PHP Version | All | ||||
Database Version | All | ||||
|
Confirmed. See attached script (test6175.php) to reproduce the issue. Output of it: string 'foobar_11' (length=9) string 'foobar_1' (length=8) string 'foobar_1' (length=8) string 'foobar_' (length=7) --------------------------- string 'foobar_11' (length=9) string 'foobar_10' (length=9) string 'foobar_01' (length=9) string 'foobar_00' (length=9) |