- improvement check if ini_get() and ini_set() not disabled

https://github.com/smarty-php/smarty/pull/362
This commit is contained in:
uwetews
2017-05-19 22:35:55 +02:00
parent 2782e83a92
commit da22c961bb
8 changed files with 130 additions and 105 deletions
@@ -80,7 +80,7 @@ class Smarty_Internal_Runtime_CacheResourceFile
}
} else {
// delete only php files
if (substr($_filepath, -4) !== '.php') {
if (substr($_filepath, - 4) !== '.php') {
continue;
}
$_parts = explode($_dir_sep, str_replace('\\', '/', substr($_filepath, $_dir_length)));
@@ -125,7 +125,9 @@ class Smarty_Internal_Runtime_CacheResourceFile
}
}
$_count += @unlink($_filepath) ? 1 : 0;
if (function_exists('opcache_invalidate') && strlen(ini_get("opcache.restrict_api")) < 1) {
if (function_exists('opcache_invalidate')
&& (!function_exists('ini_get') || strlen(ini_get("opcache.restrict_api")) < 1)
) {
opcache_invalidate($_filepath, true);
}
}