summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUwe.Tews@googlemail.com <Uwe.Tews@googlemail.com>2014-02-17 18:21:31 +0000
committerUwe.Tews@googlemail.com <Uwe.Tews@googlemail.com>2014-02-17 18:21:31 +0000
commitf06013927c187ce1cb7da136320e369863bfb2ef (patch)
tree93214ac5531f073a3c1380961ce2e195bd6e8409
parentbfa0ce8ba4565e7bbc9a909f27f9640415c68139 (diff)
downloadsmarty-f06013927c187ce1cb7da136320e369863bfb2ef.tar.gz
smarty-f06013927c187ce1cb7da136320e369863bfb2ef.tar.bz2
smarty-f06013927c187ce1cb7da136320e369863bfb2ef.zip
- bugfix Smarty failed when executing PHP on HHVM (Hip Hop 2.4) because uniqid('',true) does return string with ',' (forum topic 20343)
-rw-r--r--change_log.txt3
-rw-r--r--libs/sysplugins/smarty_internal_compile_include.php2
-rw-r--r--libs/sysplugins/smarty_internal_template.php4
-rw-r--r--libs/sysplugins/smarty_internal_templatecompilerbase.php2
-rw-r--r--libs/sysplugins/smarty_internal_write_file.php2
5 files changed, 8 insertions, 5 deletions
diff --git a/change_log.txt b/change_log.txt
index 82d0d1e1..800de6f2 100644
--- a/change_log.txt
+++ b/change_log.txt
@@ -1,4 +1,7 @@
===== trunk =====
+ 17.02.2014
+ - bugfix Smarty failed when executing PHP on HHVM (Hip Hop 2.4) because uniqid('',true) does return string with ',' (forum topic 20343)
+
16.02.2014
- bugfix a '//' or '\\' in template_dir path could produce wrong path on relative filepath in {include} (Issue 175)
diff --git a/libs/sysplugins/smarty_internal_compile_include.php b/libs/sysplugins/smarty_internal_compile_include.php
index 27ad617e..eb356cfa 100644
--- a/libs/sysplugins/smarty_internal_compile_include.php
+++ b/libs/sysplugins/smarty_internal_compile_include.php
@@ -169,7 +169,7 @@ class Smarty_Internal_Compile_Include extends Smarty_Internal_CompileBase
if (!isset($compiler->smarty->merged_templates_func[$tpl_name][$uid])) {
$tpl = new $compiler->smarty->template_class ($tpl_name, $compiler->smarty, $compiler->template, $compiler->template->cache_id, $compiler->template->compile_id);
// save unique function name
- $compiler->smarty->merged_templates_func[$tpl_name][$uid]['func'] = $tpl->properties['unifunc'] = 'content_' . str_replace('.', '_', uniqid('', true));
+ $compiler->smarty->merged_templates_func[$tpl_name][$uid]['func'] = $tpl->properties['unifunc'] = 'content_' . str_replace(array('.',','), '_', uniqid('', true));
// use current nocache hash for inlined code
$compiler->smarty->merged_templates_func[$tpl_name][$uid]['nocache_hash'] = $tpl->properties['nocache_hash'] = $compiler->template->properties['nocache_hash'];
if ($compiler->template->caching && $_caching == self::CACHING_NOCACHE_CODE) {
diff --git a/libs/sysplugins/smarty_internal_template.php b/libs/sysplugins/smarty_internal_template.php
index c2bf4501..47dac93d 100644
--- a/libs/sysplugins/smarty_internal_template.php
+++ b/libs/sysplugins/smarty_internal_template.php
@@ -217,7 +217,7 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase
return false;
}
$this->properties['cache_lifetime'] = $this->cache_lifetime;
- $this->properties['unifunc'] = 'content_' . str_replace('.', '_', uniqid('', true));
+ $this->properties['unifunc'] = 'content_' . str_replace(array('.',','), '_', uniqid('', true));
$content = $this->createTemplateCodeFrame($content, true);
$_smarty_tpl = $this;
eval("?>" . $content);
@@ -399,7 +399,7 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase
}
$this->properties['version'] = Smarty::SMARTY_VERSION;
if (!isset($this->properties['unifunc'])) {
- $this->properties['unifunc'] = 'content_' . str_replace('.', '_', uniqid('', true));
+ $this->properties['unifunc'] = 'content_' . str_replace(array('.',','), '_', uniqid('', true));
}
if (!$this->source->recompiled) {
$output .= "\$_valid = \$_smarty_tpl->decodeProperties(" . var_export($this->properties, true) . ',' . ($cache ? 'true' : 'false') . "); /*/%%SmartyHeaderCode%%*/?>\n";
diff --git a/libs/sysplugins/smarty_internal_templatecompilerbase.php b/libs/sysplugins/smarty_internal_templatecompilerbase.php
index d7268fbf..fcfb25ef 100644
--- a/libs/sysplugins/smarty_internal_templatecompilerbase.php
+++ b/libs/sysplugins/smarty_internal_templatecompilerbase.php
@@ -203,7 +203,7 @@ abstract class Smarty_Internal_TemplateCompilerBase
*/
public function __construct()
{
- $this->nocache_hash = str_replace('.', '-', uniqid(rand(), true));
+ $this->nocache_hash = str_replace(array('.',','), '-', uniqid(rand(), true));
}
/**
diff --git a/libs/sysplugins/smarty_internal_write_file.php b/libs/sysplugins/smarty_internal_write_file.php
index a62fa947..770b56f5 100644
--- a/libs/sysplugins/smarty_internal_write_file.php
+++ b/libs/sysplugins/smarty_internal_write_file.php
@@ -38,7 +38,7 @@ class Smarty_Internal_Write_File
}
// write to tmp file, then move to overt file lock race condition
- $_tmp_file = $_dirpath . DS . uniqid('wrt', true);
+ $_tmp_file = $_dirpath . DS . str_replace(array('.',','), '_', uniqid('wrt', true));
if (!file_put_contents($_tmp_file, $_contents)) {
error_reporting($_error_reporting);
throw new SmartyException("unable to write file {$_tmp_file}");