From 913dc94e2c6ea2fa3909efd11bb4908ef2fa9d90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Bl=C3=A4ul?= Date: Sun, 11 Feb 2018 09:44:43 +0100 Subject: [PATCH] Keep sorting keys compatible: Moved array_values call to PHPUnit. This commit partially reverts adcd258ea2e4d30c64f468bd1376118bcfdd92c1. --- parsecsv.lib.php | 3 --- tests/properties/BaseClass.php | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/parsecsv.lib.php b/parsecsv.lib.php index 4ea9e08..beffd1e 100644 --- a/parsecsv.lib.php +++ b/parsecsv.lib.php @@ -730,9 +730,6 @@ 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); } diff --git a/tests/properties/BaseClass.php b/tests/properties/BaseClass.php index 4d9c420..1131ac8 100644 --- a/tests/properties/BaseClass.php +++ b/tests/properties/BaseClass.php @@ -26,6 +26,6 @@ class BaseClass extends PHPUnit\Framework\TestCase { $actual = array_map(function ($row) { return $row['title']; }, $this->csv->data); - $this->assertEquals($expected, $actual); + $this->assertEquals($expected, array_values($actual)); } }