Browse code

Handle opcache_invalidate() being disabled on shared hosting platforms

This fix makes twig gracefully fail on opcache API being disabled on shared hosting platforms for security reasons.
Tested with Grav CMS.

Rhys authored on 07/08/2019 16:37:38 • Fabien Potencier committed on 21/08/2019 05:12:20
Showing 1 changed files
... ...
@@ -68,7 +68,7 @@ class FilesystemCache implements CacheInterface
68 68
             if (self::FORCE_BYTECODE_INVALIDATION == ($this->options & self::FORCE_BYTECODE_INVALIDATION)) {
69 69
                 // Compile cached file into bytecode cache
70 70
                 if (\function_exists('opcache_invalidate') && filter_var(ini_get('opcache.enable'), FILTER_VALIDATE_BOOLEAN)) {
71
-                    opcache_invalidate($key, true);
71
+                    @opcache_invalidate($key, true);
72 72
                 } elseif (\function_exists('apc_compile_file')) {
73 73
                     apc_compile_file($key);
74 74
                 }