From 2d1a90451264da93198a4f6bc80ea55fbb9fc9bf Mon Sep 17 00:00:00 2001 From: vosco88 Date: Fri, 23 Nov 2018 16:36:24 +0100 Subject: [PATCH] Extend opcache check if it is enabled (#3664) Credit to @vosco88. When trying to deploy October on shared hosting (www.websupport.sk) it is possible to receive the following error when accessing the frontend pages - ErrorException:> Zend OPcache API is restricted by "restrict_api" configuration directive. This checks not only if the opcache_invalidate exists but also if opcache is enabled. Same check is actually present in twig vendor files - but so far it is working without having the check there. --- modules/cms/classes/CodeParser.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/cms/classes/CodeParser.php b/modules/cms/classes/CodeParser.php index e908f1137..08f257843 100644 --- a/modules/cms/classes/CodeParser.php +++ b/modules/cms/classes/CodeParser.php @@ -334,7 +334,7 @@ class CodeParser * Compile cached file into bytecode cache */ if (Config::get('cms.forceBytecodeInvalidation', false)) { - if (function_exists('opcache_invalidate')) { + if (function_exists('opcache_invalidate') && ini_get('opcache.enable')) { opcache_invalidate($path, true); } elseif (function_exists('apc_compile_file')) {