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:
Christian Bläul
2018-02-02 12:22:23 +01:00
committed by Fonata
parent 7470d2b804
commit 75902f4a22
3 changed files with 90 additions and 0 deletions

View File

@@ -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);
}