Permalink
Browse files

FIX Make sure ArrayList#limit uses clone so for subclasses it returns…

… instances of same subclass
  • Loading branch information...
1 parent 27113f8 commit 9979b11b59483c7178500b07d0b636ac99d76246 Hamish Friedlander committed Dec 12, 2012
Showing with 3 additions and 1 deletion.
  1. +3 −1 model/ArrayList.php
View
@@ -130,7 +130,9 @@ public function toNestedArray() {
* @return ArrayList
*/
public function limit($length, $offset = 0) {
- return new ArrayList(array_slice($this->items, $offset, $length));
+ $list = clone $this;
+ $list->items = array_slice($this->items, $offset, $length);
+ return $list;
}
/**

0 comments on commit 9979b11

Please sign in to comment.