mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-06 03:14:27 +02:00
- improvement sha1() for array keys longer than 150 characters
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
===== trunk =====
|
===== trunk =====
|
||||||
21.10.2011
|
21.10.2011
|
||||||
- bugfix apostrope in plugins_dir path name failed (forum topic 20199)
|
- bugfix apostrophe in plugins_dir path name failed (forum topic 20199)
|
||||||
|
- improvement sha1() for array keys longer than 150 characters
|
||||||
|
|
||||||
20.10.2011
|
20.10.2011
|
||||||
- @silenced unlink() in Smarty_Internal_Write_File since debuggers go haywire without it.
|
- @silenced unlink() in Smarty_Internal_Write_File since debuggers go haywire without it.
|
||||||
|
@@ -1174,6 +1174,9 @@ class Smarty extends Smarty_Internal_TemplateBase {
|
|||||||
// already in template cache?
|
// already in template cache?
|
||||||
$unique_template_name = Smarty_Resource::getUniqueTemplateName($this, $template);
|
$unique_template_name = Smarty_Resource::getUniqueTemplateName($this, $template);
|
||||||
$_templateId = $unique_template_name . $cache_id . $compile_id;
|
$_templateId = $unique_template_name . $cache_id . $compile_id;
|
||||||
|
if (isset($_templateId[150])) {
|
||||||
|
$_templateId = sha1($_templateId);
|
||||||
|
}
|
||||||
if ($do_clone) {
|
if ($do_clone) {
|
||||||
if (isset($this->template_objects[$_templateId])) {
|
if (isset($this->template_objects[$_templateId])) {
|
||||||
// return cached template object
|
// return cached template object
|
||||||
|
@@ -179,6 +179,9 @@ abstract class Smarty_CacheResource_KeyValueStore extends Smarty_CacheResource {
|
|||||||
|
|
||||||
// remove from template cache
|
// remove from template cache
|
||||||
$_templateId = $tpl->source->unique_resource . $tpl->cache_id . $tpl->compile_id;
|
$_templateId = $tpl->source->unique_resource . $tpl->cache_id . $tpl->compile_id;
|
||||||
|
if (isset($_templateId[150])) {
|
||||||
|
$_templateId = sha1($_templateId);
|
||||||
|
}
|
||||||
unset($smarty->template_objects[$_templateId]);
|
unset($smarty->template_objects[$_templateId]);
|
||||||
}
|
}
|
||||||
return $uid;
|
return $uid;
|
||||||
|
@@ -155,6 +155,9 @@ class Smarty_Internal_CacheResource_File extends Smarty_CacheResource {
|
|||||||
// remove from template cache
|
// remove from template cache
|
||||||
$tpl->source; // have the template registered before unset()
|
$tpl->source; // have the template registered before unset()
|
||||||
$_templateId = $tpl->source->unique_resource . $tpl->cache_id . $tpl->compile_id;
|
$_templateId = $tpl->source->unique_resource . $tpl->cache_id . $tpl->compile_id;
|
||||||
|
if (isset($_templateId[150])) {
|
||||||
|
$_templateId = sha1($_templateId);
|
||||||
|
}
|
||||||
unset($smarty->template_objects[$_templateId]);
|
unset($smarty->template_objects[$_templateId]);
|
||||||
|
|
||||||
if ($tpl->source->exists) {
|
if ($tpl->source->exists) {
|
||||||
|
@@ -247,6 +247,9 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase {
|
|||||||
// already in template cache?
|
// already in template cache?
|
||||||
$unique_template_name = Smarty_Resource::getUniqueTemplateName($this->smarty, $template);
|
$unique_template_name = Smarty_Resource::getUniqueTemplateName($this->smarty, $template);
|
||||||
$_templateId = $unique_template_name . $cache_id . $compile_id;
|
$_templateId = $unique_template_name . $cache_id . $compile_id;
|
||||||
|
if (isset($_templateId[150])) {
|
||||||
|
$_templateId = sha1($_templateId);
|
||||||
|
}
|
||||||
if (isset($this->smarty->template_objects[$_templateId])) {
|
if (isset($this->smarty->template_objects[$_templateId])) {
|
||||||
// clone cached template object because of possible recursive call
|
// clone cached template object because of possible recursive call
|
||||||
$tpl = clone $this->smarty->template_objects[$_templateId];
|
$tpl = clone $this->smarty->template_objects[$_templateId];
|
||||||
@@ -623,6 +626,9 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase {
|
|||||||
// do not cache eval resources
|
// do not cache eval resources
|
||||||
if ($this->source->type != 'eval') {
|
if ($this->source->type != 'eval') {
|
||||||
$_templateId = $this->source->unique_resource . $this->cache_id . $this->compile_id;
|
$_templateId = $this->source->unique_resource . $this->cache_id . $this->compile_id;
|
||||||
|
if (isset($_templateId[150])) {
|
||||||
|
$_templateId = sha1($_templateId);
|
||||||
|
}
|
||||||
$this->smarty->template_objects[$_templateId] = $this;
|
$this->smarty->template_objects[$_templateId] = $this;
|
||||||
}
|
}
|
||||||
return $this->source;
|
return $this->source;
|
||||||
|
@@ -193,6 +193,9 @@ class Smarty_Internal_Utility {
|
|||||||
// remove from template cache
|
// remove from template cache
|
||||||
$tpl->source; // have the template registered before unset()
|
$tpl->source; // have the template registered before unset()
|
||||||
$_templateId = $tpl->source->unique_resource . $tpl->cache_id . $tpl->compile_id;
|
$_templateId = $tpl->source->unique_resource . $tpl->cache_id . $tpl->compile_id;
|
||||||
|
if (isset($_templateId[150])) {
|
||||||
|
$_templateId = sha1($_templateId);
|
||||||
|
}
|
||||||
unset($smarty->template_objects[$_templateId]);
|
unset($smarty->template_objects[$_templateId]);
|
||||||
|
|
||||||
if ($tpl->source->exists) {
|
if ($tpl->source->exists) {
|
||||||
|
Reference in New Issue
Block a user