Browse code

bug #3105 Handle opcache_invalidate() being disabled on shared hosting platforms (RhvsW)

This PR was submitted for the 2.x branch but it was merged into the 1.x branch instead (closes #3105).

Discussion
----------

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.

Commits
-------

349a5f26 Handle opcache_invalidate() being disabled on shared hosting platforms

Fabien Potencier authored on 21/08/2019 05:12:26
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
                 }