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.
This commit is contained in:
Rhys
2019-08-07 17:37:38 +01:00
committed by Fabien Potencier
parent a8c77b85a7
commit 349a5f26c3
+1 -1
View File
@@ -68,7 +68,7 @@ class FilesystemCache implements CacheInterface
if (self::FORCE_BYTECODE_INVALIDATION == ($this->options & self::FORCE_BYTECODE_INVALIDATION)) {
// Compile cached file into bytecode cache
if (\function_exists('opcache_invalidate') && filter_var(ini_get('opcache.enable'), FILTER_VALIDATE_BOOLEAN)) {
opcache_invalidate($key, true);
@opcache_invalidate($key, true);
} elseif (\function_exists('apc_compile_file')) {
apc_compile_file($key);
}