From 670d5d710065b8035b1c7343f99567fe15237691 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Mon, 26 Dec 2011 22:06:43 +0100 Subject: [PATCH] fixed Twig_Node_Expression_Array::hasElement() --- lib/Twig/Node/Expression/Array.php | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) 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; } } -- 1.7.2.5