From 485816cc4cbdff45d375a254d2e91d00fe7e7b5d Mon Sep 17 00:00:00 2001 From: Manuel Raynaud Date: Wed, 29 Jan 2014 21:21:27 +0100 Subject: [PATCH] change argument hash creation --- core/lib/Thelia/Core/Template/Element/BaseLoop.php | 4 ++-- core/lib/Thelia/Core/Template/Loop/Argument/Argument.php | 6 ++++++ .../Core/Template/Loop/Argument/ArgumentCollection.php | 7 ++++++- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/core/lib/Thelia/Core/Template/Element/BaseLoop.php b/core/lib/Thelia/Core/Template/Element/BaseLoop.php index 2aa5e874f..215537431 100644 --- a/core/lib/Thelia/Core/Template/Element/BaseLoop.php +++ b/core/lib/Thelia/Core/Template/Element/BaseLoop.php @@ -339,7 +339,7 @@ abstract class BaseLoop public function count() { $hash = $this->args->getHash(); - if(false === array_key_exists($hash, self::$cacheCount)) + if(false === isset(self::$cacheCount[$hash])) { $count = 0; if ($this instanceof PropelSearchLoopInterface) { @@ -370,7 +370,7 @@ abstract class BaseLoop public function exec(&$pagination) { $hash = $this->args->getHash(); - if(false === array_key_exists($hash, self::$cacheLoopResult)) + if(false === isset(self::$cacheLoopResult[$hash])) { if ($this instanceof PropelSearchLoopInterface) { $searchModelCriteria = $this->buildModelCriteria(); diff --git a/core/lib/Thelia/Core/Template/Loop/Argument/Argument.php b/core/lib/Thelia/Core/Template/Loop/Argument/Argument.php index 0ba86e7d0..56100e490 100644 --- a/core/lib/Thelia/Core/Template/Loop/Argument/Argument.php +++ b/core/lib/Thelia/Core/Template/Loop/Argument/Argument.php @@ -56,6 +56,11 @@ class Argument return $this->type->getFormattedValue($this->value); } + public function getRawValue() + { + return $this->value; + } + public function setValue($value) { if ($value === null) { @@ -147,4 +152,5 @@ class Argument $empty ); } + } diff --git a/core/lib/Thelia/Core/Template/Loop/Argument/ArgumentCollection.php b/core/lib/Thelia/Core/Template/Loop/Argument/ArgumentCollection.php index 7f5a604c5..eb815c708 100644 --- a/core/lib/Thelia/Core/Template/Loop/Argument/ArgumentCollection.php +++ b/core/lib/Thelia/Core/Template/Loop/Argument/ArgumentCollection.php @@ -153,6 +153,11 @@ class ArgumentCollection implements \Iterator unset($arguments['name']); } - return sha1(serialize($arguments)); + $string = ''; + foreach ($arguments as $key => $argument) { + $string .= $key.'='.$argument->getRawValue(); + } + + return md5($string); } }