Browse files

fixed Twig_Node_Expression_Array::hasElement()

  • Loading branch information...
1 parent fb6d566 commit 670d5d710065b8035b1c7343f99567fe15237691 @fabpot committed Dec 26, 2011
Showing with 3 additions and 1 deletion.
  1. +3 −1 lib/Twig/Node/Expression/Array.php
View
4 lib/Twig/Node/Expression/Array.php
@@ -41,7 +41,9 @@ public function getKeyValuePairs()
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;
}
}

0 comments on commit 670d5d7

Please sign in to comment.