I find this error on a web page that runs with Symfony 4.3.2
Failed to save key "xxxx" of type array: touch(): Utime failed: Operation not permitted
but I have no idea where it comes from, so if someone has a little lead, I’m a buyer. I don’t know if it can help but I use ubuntu on windows 10
[2019-07-26 16:04:09] php.DEBUG: Warning: chmod(): Operation not permitted {"exception":"[object] (Symfony\Component\Debug\Exception\SilencedErrorContext: {"severity":2,"file":"/devdir/myProject/vendor/symfony/filesystem/Filesystem.php","line":696,"trace":[{"file":"/devdir/myProject/vendor/symfony/config/ResourceCheckerConfigCache.php","line":124,"function":"dumpFile","class":"Symfony\\Component\\Filesystem\\Filesystem","type":"->"}],"count":1})"} [] [2019-07-26 16:04:09] php.DEBUG: Warning: chmod(): Operation not permitted {"exception":"[object] (Symfony\Component\Debug\Exception\SilencedErrorContext: {"severity":2,"file":"/devdir/myProject/vendor/symfony/filesystem/Filesystem.php","line":202,"trace":[{"file":"/devdir/myProject/vendor/symfony/config/ResourceCheckerConfigCache.php","line":126,"function":"chmod","class":"Symfony\\Component\\Filesystem\\Filesystem","type":"->"}],"count":1})"} [] [2019-07-26 16:04:09] request.INFO: Matched route "fos_js_routing_js". {"route":"fos_js_routing_js","route_parameters":{"_route":"fos_js_routing_js","_controller":"fos_js_routing.controller::indexAction","_format":"js"},"request_uri":"http://myProject.local/js/routing?callback=fos.Router.setData","method":"GET"} [] [2019-07-26 16:04:09] cache.WARNING: Failed to save key "%5BFOS%5CJsRoutingBundle%5CController%5CController%5D%5B1%5D" of type array: touch(): Utime failed: Operation not permitted {"key":"%5BFOS%5CJsRoutingBundle%5CController%5CController%5D%5B1%5D","exception":"[object] (ErrorException(code: 0): touch(): Utime failed: Operation not permitted at /devdir/myProject/vendor/symfony/cache/Traits/FilesystemCommonTrait.php:95)"} [] [2019-07-26 16:04:09] cache.WARNING: Failed to save key "%5B%5BC%5DFOS%5CJsRoutingBundle%5CController%5CController%5D%5B1%5D" of type integer: touch(): Utime failed: Operation not permitted {"key":"%5B%5BC%5DFOS%5CJsRoutingBundle%5CController%5CController%5D%5B1%5D","exception":"[object] (ErrorException(code: 0): touch(): Utime failed: Operation not permitted at /devdir/myProject/vendor/symfony/cache/Traits/FilesystemCommonTrait.php:95)"} [] [2019-07-26 16:04:09] cache.WARNING: Failed to save key "%5BFOS%5CJsRoutingBundle%5CController%5CController%23indexAction%5D%5B1%5D" of type array: touch(): Utime failed: Operation not permitted {"key":"%5BFOS%5CJsRoutingBundle%5CController%5CController%23indexAction%5D%5B1%5D","exception":"[object] (ErrorException(code: 0): touch(): Utime failed: Operation not permitted at /devdir/myProject/vendor/symfony/cache/Traits/FilesystemCommonTrait.php:95)"} [] [2019-07-26 16:04:09] cache.WARNING: Failed to save key "%5B%5BC%5DFOS%5CJsRoutingBundle%5CController%5CController%23indexAction%5D%5B1%5D" of type integer: touch(): Utime failed: Operation not permitted {"key":"%5B%5BC%5DFOS%5CJsRoutingBundle%5CController%5CController%23indexAction%5D%5B1%5D","exception":"[object] (ErrorException(code: 0): touch(): Utime failed: Operation not permitted at /devdir/myProject/vendor/symfony/cache/Traits/FilesystemCommonTrait.php:95)"} [] [2019-07-26 16:04:20] request.INFO: Matched route "fos_js_routing_js". {"route":"fos_js_routing_js","route_parameters":{"_route":"fos_js_routing_js","_controller":"fos_js_routing.controller::indexAction","_format":"js"},"request_uri":"http://myProject.local/js/routing?callback=fos.Router.setData","method":"GET"} [] [2019-07-26 16:04:21] cache.WARNING: Failed to save key "%5BFOS%5CJsRoutingBundle%5CController%5CController%5D%5B1%5D" of type array: touch(): Utime failed: Operation not permitted {"key":"%5BFOS%5CJsRoutingBundle%5CController%5CController%5D%5B1%5D","exception":"[object] (ErrorException(code: 0): touch(): Utime failed: Operation not permitted at /devdir/myProject/vendor/symfony/cache/Traits/FilesystemCommonTrait.php:95)"} [] [2019-07-26 16:04:21] cache.WARNING: Failed to save key "%5B%5BC%5DFOS%5CJsRoutingBundle%5CController%5CController%5D%5B1%5D" of type integer: touch(): Utime failed: Operation not permitted {"key":"%5B%5BC%5DFOS%5CJsRoutingBundle%5CController%5CController%5D%5B1%5D","exception":"[object] (ErrorException(code: 0): touch(): Utime failed: Operation not permitted at /devdir/myProject/vendor/symfony/cache/Traits/FilesystemCommonTrait.php:95)"} [] [2019-07-26 16:04:21] cache.WARNING: Failed to save key "%5BFOS%5CJsRoutingBundle%5CController%5CController%23indexAction%5D%5B1%5D" of type array: touch(): Utime failed: Operation not permitted {"key":"%5BFOS%5CJsRoutingBundle%5CController%5CController%23indexAction%5D%5B1%5D","exception":"[object] (ErrorException(code: 0): touch(): Utime failed: Operation not permitted at /devdir/myProject/vendor/symfony/cache/Traits/FilesystemCommonTrait.php:95)"} [] [2019-07-26 16:04:21] cache.WARNING: Failed to save key "%5B%5BC%5DFOS%5CJsRoutingBundle%5CController%5CController%23indexAction%5D%5B1%5D" of type integer: touch(): Utime failed: Operation not permitted {"key":"%5B%5BC%5DFOS%5CJsRoutingBundle%5CController%5CController%23indexAction%5D%5B1%5D","exception":"[object] (ErrorException(code: 0): touch(): Utime failed: Operation not permitted at /devdir/myProject/vendor/symfony/cache/Traits/FilesystemCommonTrait.php:95)"} [] [2019-07-26 16:04:21] request.INFO: Matched route "_wdt". {"route":"_wdt","route_parameters":{"_route":"_wdt","_controller":"web_profiler.controller.profiler::toolbarAction","token":"a0f28c"},"request_uri":"http://myProject.local/_wdt/a0f28c","method":"GET"} [] [2019-07-26 16:04:21] cache.WARNING: Failed to save key "%5BSymfony%5CBundle%5CWebProfilerBundle%5CController%5CProfilerController%5D%5B1%5D" of type array: touch(): Utime failed: Operation not permitted {"key":"%5BSymfony%5CBundle%5CWebProfilerBundle%5CController%5CProfilerController%5D%5B1%5D","exception":"[object] (ErrorException(code: 0): touch(): Utime failed: Operation not permitted at /devdir/myProject/vendor/symfony/cache/Traits/FilesystemCommonTrait.php:95)"} [] [2019-07-26 16:04:21] cache.WARNING: Failed to save key "%5B%5BC%5DSymfony%5CBundle%5CWebProfilerBundle%5CController%5CProfilerController%5D%5B1%5D" of type integer: touch(): Utime failed: Operation not permitted {"key":"%5B%5BC%5DSymfony%5CBundle%5CWebProfilerBundle%5CController%5CProfilerController%5D%5B1%5D","exception":"[object] (ErrorException(code: 0): touch(): Utime failed: Operation not permitted at /devdir/myProject/vendor/symfony/cache/Traits/FilesystemCommonTrait.php:95)"} [] [2019-07-26 16:04:21] cache.WARNING: Failed to save key "%5BSymfony%5CBundle%5CWebProfilerBundle%5CController%5CProfilerController%23toolbarAction%5D%5B1%5D" of type array: touch(): Utime failed: Operation not permitted {"key":"%5BSymfony%5CBundle%5CWebProfilerBundle%5CController%5CProfilerController%23toolbarAction%5D%5B1%5D","exception":"[object] (ErrorException(code: 0): touch(): Utime failed: Operation not permitted at /devdir/myProject/vendor/symfony/cache/Traits/FilesystemCommonTrait.php:95)"} [] [2019-07-26 16:04:21] cache.WARNING: Failed to save key "%5B%5BC%5DSymfony%5CBundle%5CWebProfilerBundle%5CController%5CProfilerController%23toolbarAction%5D%5B1%5D" of type integer: touch(): Utime failed: Operation not permitted {"key":"%5B%5BC%5DSymfony%5CBundle%5CWebProfilerBundle%5CController%5CProfilerController%23toolbarAction%5D%5B1%5D","exception":"[object] (ErrorException(code: 0): touch(): Utime failed: Operation not permitted at /devdir/myProject/vendor/symfony/cache/Traits/FilesystemCommonTrait.php:95)"} []
Advertisement
Answer
If you happened to use FAT/FAT32 or another file system with severely limited timestamp range, then that warning is to be expected.
Symfony’s FilesystemCommonTrait::write()
method calls touch()
function with unix timestamp 0 to force expire cached content. Unix timestamp 0 represents 1970-01-01 date. In FAT file system the allowed timestamp range is 1980-01-01 to 2099-12-31, according Wikipedia. So the touch()
function fails and a warning is issued.
The workaround is to modify the FilesystemCommonTrait::write()
method, around line 80.
Find lines:
if (null !== $expiresAt) { touch($this->tmp, $expiresAt); }
Insert before those lines:
if (0 === $expiresAt) { $expiresAt = time() - 1; }
This should achieve virtually the same result by instantly expiring the cached content, but without using an invalid file system timestamp.
Alternatively, change the file system type.