mirror of
https://github.com/parsecsv/parsecsv-for-php.git
synced 2026-02-19 08:36:39 +00:00
Added PHPUnit test for sorting; I could not get the rows in the right...
order without calling array_values - maybe this helps just PHPUnit. I consider the risk of breaking library users' code unlikely.
This commit is contained in:
@@ -730,6 +730,9 @@ class parseCSV {
|
||||
|
||||
$this->sort_reverse ? krsort($rows, $sort_type) : ksort($rows, $sort_type);
|
||||
|
||||
// Avoid issues with mixing string and integer keys:
|
||||
$rows = array_values($rows);
|
||||
|
||||
if ($this->offset !== null || $this->limit !== null) {
|
||||
$rows = array_slice($rows, ($this->offset === null ? 0 : $this->offset), $this->limit, true);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user