View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0003395 | OXID eShop (all versions) | 1.04. Content, static (register, contact etc.) pages | public | 2011-11-27 13:42 | 2012-12-07 10:28 |
Reporter | Adrian.Kirchner | Assigned To | |||
Priority | urgent | Severity | block | Reproducibility | always |
Status | resolved | Resolution | fixed | ||
Product Version | 4.5.4 revision 39463 | ||||
Fixed in Version | 4.5.7 revision 41909 | ||||
Summary | 0003395: Race condition in smarty func oxcontent cache mechanism when called with oxloadid param and oxloadid is present in two malls | ||||
Description | When you use the smarty function oxcontent eg. like that: > [{oxcontent ident="oxstartwelcome"}] to include the welcome content page in the projects template set, you'll run into a race condition under "heavy load" if those idents are used in two or more malls. There are two reasons for that: 1) The cache id is built out of the oxloadid (which has no unique constraint in the databse, of course) and the mall id is missing. You can find a patch attached to this report. 2) The way how the template compilation is forced is inappropriate. See the ox_get_timestamp()-function in the core/oxfunctions.php file. There is a comment "alway compile" followed by this code: > $iTplTimestamp = time(); I don't know the smarty internals but here we need an appropriate way of compilation forcing. So this leads to the problem. If the mall with id 1 is requested, each request in the same server second to all other malls is served with the content from mall id 1. | ||||
Steps To Reproduce | To reproduce that: 1) Create to content sites with the same oxloadid. Apply different content to that tuples. 2) Include those content snippets to your template by ident and via the oxcontent function 3) Change the following lines in the ox_get_timestamp()-function in the core/oxfunctions.php file: - $iTplTimestamp = time(); + $iTplTimestamp = 123; 4) browse to the first mall and make sure that this is the first request after cleaning the tmp-folder 5) browse to the second mall -> you will see the content of mall 1. | ||||
Additional Information | As the content functionality is often used to render informations which are demanded by law (imprint, payment- and shippingconditions), this is a very serious bug. The attached patch fixes that bug and is diffed against the current public trunk. | ||||
Tags | Cache | ||||
Attached Files | function.oxcontent.patch.php (838 bytes)
--- function.oxcontent.php 2011-11-27 13:31:36.000000000 +0100 +++ function.oxcontent_fix.php 2011-11-27 13:32:41.000000000 +0100 @@ -64,8 +64,8 @@ $sProp = 'oxcontents__'.$sField; $smarty->oxidcache = clone $oContent->$sProp; $smarty->compile_check = true; - $sCacheId = oxLang::getInstance()->getBaseLanguage().(int) $myConfig->getShopCurrency(); - $sText = $smarty->fetch( "ox:".(string)$sIdent.(string)$sOxid.$sField.$sCacheId); + $sCacheId = oxLang::getInstance()->getBaseLanguage().(int) $myConfig->getShopCurrency().(int) $myConfig->getShopId(); + $sText = $smarty->fetch( "ox:".(string)$oContent->getId().(string)$sOxid.$sField.$sCacheId); $smarty->compile_check = $myConfig->getConfigParam( 'blCheckTemplates' ); } } | ||||
Theme | Both | ||||
Browser | All | ||||
PHP Version | any | ||||
Database Version | any | ||||