This fix makes twig gracefully fail on opcache API being disabled on shared hosting platforms for security reasons.
Tested with Grav CMS.
... | ... |
@@ -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 |
} |