mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-04 18:34:27 +02:00
- bugfix Smarty failed when compile_id did contain "|"
This commit is contained in:
@@ -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
|
||||
|
@@ -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
|
||||
|
@@ -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) {
|
||||
|
@@ -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) {
|
||||
|
@@ -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();
|
||||
|
@@ -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;
|
||||
|
@@ -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();
|
||||
}
|
||||
|
Reference in New Issue
Block a user