Skip to content
Browse files

Fixed key providing to ArrayCollection::map.

  • Loading branch information...
1 parent bc59c86 commit ccf2f4fcf7e98d7d91cff419e1cce4c8ea9c5d8c @hype- hype- committed Feb 14, 2013
View
2 library/Xi/Collections/Collection/ArrayCollection.php
@@ -123,7 +123,7 @@ public function map($callback)
private function addKeyArgument($callback)
{
$values = $this->elements;
- return function($value) use($callback, $values) {
+ return function($value) use($callback, &$values) {
list($key) = each($values);
return $callback($value, $key);
};
View
1 tests/Xi/Collections/Collection/AbstractCollectionTest.php
@@ -145,6 +145,7 @@ public function keyMapSet()
{
return array(
array(array('foo' => null), array('foo' => 'foo')),
+ array(array('min' => 1, 'max' => 3), array('min' => 'min', 'max' => 'max')),
);
}

0 comments on commit ccf2f4f

Please sign in to comment.
Something went wrong with that request. Please try again.