mirror of
https://github.com/smarty-php/smarty.git
synced 2025-11-02 21:31:48 +01:00
- bugfix avoid opcache_invalidate to result in ErrorException when opcache.restrict_api is not empty https://github.com/smarty-php/smarty/pull/244
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user