diff --git a/ChangeLog b/ChangeLog index 79cbd46b..2b9dd462 100644 --- a/ChangeLog +++ b/ChangeLog @@ -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 diff --git a/libs/Smarty.class.php b/libs/Smarty.class.php index 1aae5e66..411ddfa1 100644 --- a/libs/Smarty.class.php +++ b/libs/Smarty.class.php @@ -562,6 +562,12 @@ class Smarty */ var $_cache_including = false; + /** + * plugin filepath cache + * + * @var array + */ + var $_filepaths_cache = array(); /**#@-*/ /** * The class constructor. diff --git a/libs/internals/core.assemble_plugin_filepath.php b/libs/internals/core.assemble_plugin_filepath.php index 690d3ddb..22c02483 100644 --- a/libs/internals/core.assemble_plugin_filepath.php +++ b/libs/internals/core.assemble_plugin_filepath.php @@ -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; }