* fixed plugin filepath cache must not be static, because of possible problem

when using multiple Smarty instances with diffrent plugins_dir settings
         https://github.com/smarty-php/smarty/issues/146
This commit is contained in:
uwetews
2015-12-30 17:07:54 +01:00
parent 47fa66cdcf
commit 4cb07a89e2
3 changed files with 15 additions and 5 deletions

View File

@@ -1,3 +1,9 @@
2015-12-30 Uwe Tews
* fixed plugin filepath cache must not be static, because of possible problem
when using multiple Smarty instances with diffrent plugins_dir settings
https://github.com/smarty-php/smarty/issues/146
2015-06-21 Uwe Tews
* PHP7 raises E_DEPRECATED use __construct for compatibility

View File

@@ -562,6 +562,12 @@ class Smarty
*/
var $_cache_including = false;
/**
* plugin filepath cache
*
* @var array
*/
var $_filepaths_cache = array();
/**#@-*/
/**
* The class constructor.

View File

@@ -14,11 +14,9 @@
*/
function smarty_core_assemble_plugin_filepath($params, &$smarty)
{
static $_filepaths_cache = array();
$_plugin_filename = $params['type'] . '.' . $params['name'] . '.php';
if (isset($_filepaths_cache[$_plugin_filename])) {
return $_filepaths_cache[$_plugin_filename];
if (isset($smarty->_filepaths_cache[$_plugin_filename])) {
return $smarty->_filepaths_cache[$_plugin_filename];
}
$_return = false;
@@ -58,7 +56,7 @@ function smarty_core_assemble_plugin_filepath($params, &$smarty)
}
}
}
$_filepaths_cache[$_plugin_filename] = $_return;
$smarty->_filepaths_cache[$_plugin_filename] = $_return;
return $_return;
}