FIX Make sure ArrayList#limit uses clone so for subclasses it returns instances of same subclass

This commit is contained in:
Hamish Friedlander 2012-12-13 10:02:18 +13:00
parent 27113f82c3
commit 9979b11b59

View File

@ -130,7 +130,9 @@ class ArrayList extends ViewableData implements SS_List, SS_Filterable, SS_Sorta
* @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;
}
/**