View Issue Details

IDProjectCategoryView StatusLast Update
0006175OXID eShop (all versions)4.08. Cachepublic2024-02-07 11:34
Reporterm4r73n Assigned To 
PrioritynormalSeverityminorReproducibilityalways
Status acknowledgedResolutionopen 
Product Version4.9.4 / 5.2.4 
Summary0006175: Concatenation of string and bool leads to wrong cache hits in oxConfig::getDir()
DescriptionIn 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.
TagsPerformance and Caching Rework
Attached Files
test6175.php (977 bytes)
ThemeAll
BrowserNot defined
PHP VersionAll
Database VersionAll

Activities

QA

2015-06-25 14:55

administrator   ~0011059

Last edited: 2015-06-25 14:57

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)