diff --git a/change_log.txt b/change_log.txt index beaaf6e1..ebea9959 100644 --- a/change_log.txt +++ b/change_log.txt @@ -3,6 +3,7 @@ - avoid possible circular object referances caused by parser/lexer objects - rewrite compileAll... utility methods - commit several internal improvements + - bugfix Smarty failed when compile_id did contain "|" 03.08.2015 - rework clear cache methods diff --git a/libs/Smarty.class.php b/libs/Smarty.class.php index 113f2b69..1bb37b63 100644 --- a/libs/Smarty.class.php +++ b/libs/Smarty.class.php @@ -111,7 +111,7 @@ class Smarty extends Smarty_Internal_TemplateBase /** * smarty version */ - const SMARTY_VERSION = '3.1.28-dev/43'; + const SMARTY_VERSION = '3.1.28-dev/44'; /** * define variable scopes diff --git a/libs/sysplugins/smarty_cacheresource_custom.php b/libs/sysplugins/smarty_cacheresource_custom.php index 15539a90..0fbf3ef8 100644 --- a/libs/sysplugins/smarty_cacheresource_custom.php +++ b/libs/sysplugins/smarty_cacheresource_custom.php @@ -83,7 +83,7 @@ abstract class Smarty_CacheResource_Custom extends Smarty_CacheResource public function populate(Smarty_Template_Cached $cached, Smarty_Internal_Template $_template) { $_cache_id = isset($cached->cache_id) ? preg_replace('![^\w\|]+!', '_', $cached->cache_id) : null; - $_compile_id = isset($cached->compile_id) ? preg_replace('![^\w\|]+!', '_', $cached->compile_id) : null; + $_compile_id = isset($cached->compile_id) ? preg_replace('![^\w]+!', '_', $cached->compile_id) : null; $path = $cached->source->filepath . $_cache_id . $_compile_id; $cached->filepath = sha1($path); if ($_template->smarty->cache_locking) { diff --git a/libs/sysplugins/smarty_internal_cacheresource_file.php b/libs/sysplugins/smarty_internal_cacheresource_file.php index ad0cd532..50233f7b 100644 --- a/libs/sysplugins/smarty_internal_cacheresource_file.php +++ b/libs/sysplugins/smarty_internal_cacheresource_file.php @@ -29,7 +29,7 @@ class Smarty_Internal_CacheResource_File extends Smarty_CacheResource { $_source_file_path = str_replace(':', '.', $_template->source->filepath); $_cache_id = isset($_template->cache_id) ? preg_replace('![^\w\|]+!', '_', $_template->cache_id) : null; - $_compile_id = isset($_template->compile_id) ? preg_replace('![^\w\|]+!', '_', $_template->compile_id) : null; + $_compile_id = isset($_template->compile_id) ? preg_replace('![^\w]+!', '_', $_template->compile_id) : null; $_filepath = $_template->source->uid; // if use_sub_dirs, break file into directories if ($_template->smarty->use_sub_dirs) { diff --git a/libs/sysplugins/smarty_internal_extension_clear.php b/libs/sysplugins/smarty_internal_extension_clear.php index 8e2f4af0..fdd04672 100644 --- a/libs/sysplugins/smarty_internal_extension_clear.php +++ b/libs/sysplugins/smarty_internal_extension_clear.php @@ -25,7 +25,7 @@ class Smarty_Internal_Extension_Clear public static function clear(Smarty $smarty, $resource_name, $cache_id, $compile_id, $exp_time) { $_cache_id = isset($cache_id) ? preg_replace('![^\w\|]+!', '_', $cache_id) : null; - $_compile_id = isset($compile_id) ? preg_replace('![^\w\|]+!', '_', $compile_id) : null; + $_compile_id = isset($compile_id) ? preg_replace('![^\w]+!', '_', $compile_id) : null; $_dir_sep = $smarty->use_sub_dirs ? '/' : '^'; $_compile_id_offset = $smarty->use_sub_dirs ? 3 : 0; $_dir = $smarty->getCacheDir(); diff --git a/libs/sysplugins/smarty_internal_extension_clearcompiled.php b/libs/sysplugins/smarty_internal_extension_clearcompiled.php index 9ec27634..e6761262 100644 --- a/libs/sysplugins/smarty_internal_extension_clearcompiled.php +++ b/libs/sysplugins/smarty_internal_extension_clearcompiled.php @@ -27,7 +27,7 @@ class Smarty_Internal_Extension_ClearCompiled if ($_compile_dir == '/') { //We should never want to delete this! return 0; } - $_compile_id = isset($compile_id) ? preg_replace('![^\w\|]+!', '_', $compile_id) : null; + $_compile_id = isset($compile_id) ? preg_replace('![^\w]+!', '_', $compile_id) : null; $_dir_sep = $smarty->use_sub_dirs ? DS : '^'; if (isset($resource_name)) { $_save_stat = $smarty->caching; diff --git a/libs/sysplugins/smarty_template_compiled.php b/libs/sysplugins/smarty_template_compiled.php index 9d5ee43a..4a320389 100644 --- a/libs/sysplugins/smarty_template_compiled.php +++ b/libs/sysplugins/smarty_template_compiled.php @@ -102,7 +102,7 @@ class Smarty_Template_Compiled **/ public function populateCompiledFilepath(Smarty_Internal_Template $_template) { - $_compile_id = isset($_template->compile_id) ? preg_replace('![^\w\|]+!', '_', $_template->compile_id) : null; + $_compile_id = isset($_template->compile_id) ? preg_replace('![^\w]+!', '_', $_template->compile_id) : null; if ($_template->source->isConfig) { $_flag = '_' . ((int) $_template->smarty->config_read_hidden + (int) $_template->smarty->config_booleanize * 2 + @@ -131,7 +131,7 @@ class Smarty_Template_Compiled // set basename if not specified $_basename = $_template->source->handler->getBasename($_template->source); if ($_basename === null) { - $_basename = basename(preg_replace('![^\w\/]+!', '_', $_template->source->name)); + $_basename = basename(preg_replace('![^\w]+!', '_', $_template->source->name)); } // separate (optional) basename by dot if ($_basename) { @@ -159,7 +159,6 @@ class Smarty_Template_Compiled ($_template->smarty->compile_check && $_template->source->getTimeStamp() > $_template->compiled->getTimeStamp()) ) { - $_template->source->compileds = array(); $this->compileTemplateSource($_template); $compileCheck = $_template->smarty->compile_check; $_template->smarty->compile_check = false; @@ -184,7 +183,6 @@ class Smarty_Template_Compiled } else { include($_template->compiled->filepath); if ($_template->mustCompile) { - $_template->source->compileds = array(); $this->compileTemplateSource($_template); $compileCheck = $_template->smarty->compile_check; $_template->smarty->compile_check = false; @@ -243,6 +241,7 @@ class Smarty_Template_Compiled */ public function compileTemplateSource(Smarty_Internal_Template $_template) { + $_template->source->compileds = array(); if (!$_template->source->recompiled) { $_template->properties['file_dependency'] = array(); }