Skip to content

Commit

Permalink
Fixed key providing to ArrayCollection::map.
Browse files Browse the repository at this point in the history
  • Loading branch information
puppe0 committed Feb 14, 2013
1 parent bc59c86 commit ccf2f4f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion library/Xi/Collections/Collection/ArrayCollection.php
Expand Up @@ -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);
};
Expand Down
1 change: 1 addition & 0 deletions tests/Xi/Collections/Collection/AbstractCollectionTest.php
Expand Up @@ -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')),
);
}

Expand Down

0 comments on commit ccf2f4f

Please sign in to comment.