Bug #69773
closedWarning when clearing all caches from within install tool
100%
Description
When using the "clearAllCache" button an error message gets shown when the APC file cache is used:
Warning: apc_delete_file(): Could not stat file /[...]/typo3temp/Cache, unable to delete from cache. in /[...]/typo3_src-6.2.14/typo3/sysext/core/Classes/Utility/OpcodeCacheUtility.php on line 84
Reason is that the called method "OpcodeCacheUtility::clearAllActive($directory)" from within "GeneralUtility::flushDirectory()" [1] will not allow to clear whole directories. Per definition the used method "apc_delete_file()" allows only to delete single file-cache entries from the APC cache when called with a string argument.
So for this to work the method "apc_delete_file()" would have to get changed to something like the following snippet when called with a directory argument:
$iterator = new \APCIterator('file', '/^'.preg_quote('/path/to/webroot/typo3temp/Cache/', '/') . '.*/'); apc_delete_file($iterator);
In fact "apc_delete_file()" won't generate a warning when there is no cache entry for the passed file (or even directory). But in this special situation a warning is generated because the passed path does not exist. Line 2827 of [1] will rename/delete the directory, in the next line the "OpcodeCacheUtility::clearAllActive()" will cause the warning. Only then afterwards the directory will get recreated.