From: Fabien Potencier Date: Mon, 26 Dec 2011 21:06:43 +0000 (+0100) Subject: fixed Twig_Node_Expression_Array::hasElement() X-Git-Url: http://git.silmor.de/gitweb/?a=commitdiff_plain;h=670d5d710065b8035b1c7343f99567fe15237691;p=web%2Fkonrad%2Ftwig.git fixed Twig_Node_Expression_Array::hasElement() --- diff --git a/lib/Twig/Node/Expression/Array.php b/lib/Twig/Node/Expression/Array.php index 541915e..1da785f 100644 --- a/lib/Twig/Node/Expression/Array.php +++ b/lib/Twig/Node/Expression/Array.php @@ -41,7 +41,9 @@ class Twig_Node_Expression_Array extends Twig_Node_Expression public function hasElement(Twig_Node_Expression $key) { foreach ($this->getKeyValuePairs() as $pair) { - if ($key == $pair['key']) { + // we compare the string representation of the keys + // to avoid comparing the line numbers which are not relevant here. + if ((string) $key == (string) $pair['key']) { return true; } }