View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0007625 | OXID eShop (all versions) | General | public | 2024-03-27 15:55 | 2024-08-14 15:22 |
Reporter | oxid0815 | Assigned To | |||
Priority | normal | Severity | major | Reproducibility | random |
Status | confirmed | Resolution | open | ||
Summary | 0007625: Fatal on writing cache files | ||||
Description | Hi, In OxidEsales\EshopEnterprise\Core\Cache\Generic\Connector\FileCacheConnector:_writeFile cache file were created via the fopen function. In some case, maybe when the cache file was already open through on other process, fopen can't open the resource and return false. In that cases flock will fail with the Exception: [2024-03-22 05:21:54] OXID Logger.ERROR: flock(): Argument 1 ($stream) must be of type resource, bool given ["[object] (TypeError(code: 0): flock(): Argument 1 ($stream) must be of type resource, bool given at /var/www/vhosts/vendor/oxid-esales/oxideshop-ee/Core/Cache/Generic/Connector/FileCacheConnector.php:240)\n[stacktrace] The following source will solve the issue: protected function _writeFile($sFilePath, $oCacheItem, $iExpires) // phpcs:ignore PSR2.Methods.MethodDeclaration.Underscore { $rHandle = fopen($sFilePath, "w"); if ($rHandle !== false) { flock($rHandle, LOCK_EX); fwrite($rHandle, serialize($oCacheItem)); flock($rHandle, LOCK_UN); fclose($rHandle); touch($sFilePath, $iExpires); } } Thanks for investigation and fixing. Best regards. | ||||
Steps To Reproduce | Added by QA -SG-: Issue is reproduced with OXID 6.5 and OXID 7.1 RC 1. Install EE 2. activate Caching under Master Settings -> Core Settings -> Caching -> Default Cache Backend -> with Cache Connector File System 3. Go to frontend and open a category page. 4. set Files in source/cache to 111 per chmod -R 111 source/cache to simulate problem with file 5. open frontend page again -> maintainance mode The code changes make the code more robust. | ||||
Tags | Cache, Performance and Caching Rework | ||||
Theme | Not defined | ||||
Browser | Not defined | ||||
PHP Version | Not defined | ||||
Database Version | Not defined | ||||