From d8542196965c5b36b94b8f660fcd16c91696a936 Mon Sep 17 00:00:00 2001 From: uwetews Date: Mon, 18 Jul 2016 19:45:30 +0200 Subject: [PATCH] - bugfix avoid opcache_invalidate to result in ErrorException when opcache.restrict_api is not empty https://github.com/smarty-php/smarty/pull/244 --- change_log.txt | 1 + libs/Smarty.class.php | 2 +- libs/sysplugins/smarty_internal_cacheresource_file.php | 2 +- libs/sysplugins/smarty_internal_extension_clear.php | 2 +- .../sysplugins/smarty_internal_method_clearcompiledtemplate.php | 2 +- libs/sysplugins/smarty_template_compiled.php | 2 +- 6 files changed, 6 insertions(+), 5 deletions(-) diff --git a/change_log.txt b/change_log.txt index 360a594f..e192c4d2 100644 --- a/change_log.txt +++ b/change_log.txt @@ -2,6 +2,7 @@ 18.07.2016 - bugfix {foreach} if key variable and item@key attribute have been used both the key variable was not updated https://github.com/smarty-php/smarty/issues/254 - bugfix modifier on plugins like {plugin|modifier ... } did fail when the plugin does return an array https://github.com/smarty-php/smarty/issues/228 + - bugfix avoid opcache_invalidate to result in ErrorException when opcache.restrict_api is not empty https://github.com/smarty-php/smarty/pull/244 14.07.2016 - bugfix wrong parameter on compileAllTemplates() and compileAllConfig() https://github.com/smarty-php/smarty/issues/231 diff --git a/libs/Smarty.class.php b/libs/Smarty.class.php index cc7c30ae..43e16ea7 100644 --- a/libs/Smarty.class.php +++ b/libs/Smarty.class.php @@ -121,7 +121,7 @@ class Smarty extends Smarty_Internal_TemplateBase /** * smarty version */ - const SMARTY_VERSION = '3.1.30-dev/82'; + const SMARTY_VERSION = '3.1.30-dev/83'; /** * define variable scopes diff --git a/libs/sysplugins/smarty_internal_cacheresource_file.php b/libs/sysplugins/smarty_internal_cacheresource_file.php index 0e80e04b..bf93a4c9 100644 --- a/libs/sysplugins/smarty_internal_cacheresource_file.php +++ b/libs/sysplugins/smarty_internal_cacheresource_file.php @@ -108,7 +108,7 @@ class Smarty_Internal_CacheResource_File extends Smarty_CacheResource if ($_template->smarty->ext->_writeFile->writeFile($_template->cached->filepath, $content, $_template->smarty) === true ) { - if (function_exists('opcache_invalidate')) { + if (function_exists('opcache_invalidate') && strlen(ini_get("opcache.restrict_api")) < 1) { opcache_invalidate($_template->cached->filepath, true); } elseif (function_exists('apc_compile_file')) { apc_compile_file($_template->cached->filepath); diff --git a/libs/sysplugins/smarty_internal_extension_clear.php b/libs/sysplugins/smarty_internal_extension_clear.php index adfe287c..e8417218 100644 --- a/libs/sysplugins/smarty_internal_extension_clear.php +++ b/libs/sysplugins/smarty_internal_extension_clear.php @@ -115,7 +115,7 @@ class Smarty_Internal_Extension_Clear } } $_count += @unlink((string) $_file) ? 1 : 0; - if (function_exists('opcache_invalidate')) { + if (function_exists('opcache_invalidate') && strlen(ini_get("opcache.restrict_api")) < 1) { opcache_invalidate((string) $_file, true); } } diff --git a/libs/sysplugins/smarty_internal_method_clearcompiledtemplate.php b/libs/sysplugins/smarty_internal_method_clearcompiledtemplate.php index 90262d6f..10ee2793 100644 --- a/libs/sysplugins/smarty_internal_method_clearcompiledtemplate.php +++ b/libs/sysplugins/smarty_internal_method_clearcompiledtemplate.php @@ -109,7 +109,7 @@ class Smarty_Internal_Method_ClearCompiledTemplate if ($unlink && @unlink($_filepath)) { $_count ++; - if (function_exists('opcache_invalidate')) { + if (function_exists('opcache_invalidate') && strlen(ini_get("opcache.restrict_api")) < 1) { opcache_invalidate($_filepath, true); } } diff --git a/libs/sysplugins/smarty_template_compiled.php b/libs/sysplugins/smarty_template_compiled.php index 01fdc123..be46529f 100644 --- a/libs/sysplugins/smarty_template_compiled.php +++ b/libs/sysplugins/smarty_template_compiled.php @@ -124,7 +124,7 @@ class Smarty_Template_Compiled extends Smarty_Template_Resource_Base */ private function loadCompiledTemplate(Smarty_Internal_Template $_smarty_tpl) { - if (function_exists('opcache_invalidate')) { + if (function_exists('opcache_invalidate') && strlen(ini_get("opcache.restrict_api")) < 1) { opcache_invalidate($this->filepath, true); } elseif (function_exists('apc_compile_file')) { apc_compile_file($this->filepath);