Merge pull request #2713 from PHPOffice/Filter-return-result-array-indexes

Bugfix to returned column indexes for FILTER() by row
This commit is contained in:
Mark Baker 2022-03-24 22:24:39 +01:00 committed by GitHub
commit 8885c4eeef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View File

@ -29,7 +29,7 @@ class Filter
return $ifEmpty ?? ExcelError::CALC(); return $ifEmpty ?? ExcelError::CALC();
} }
return array_values($result); return array_values(array_map('array_values', $result));
} }
private static function enumerateArrayKeys(array $sortArray): array private static function enumerateArrayKeys(array $sortArray): array

View File

@ -15,7 +15,7 @@ class FilterTest extends TestCase
['East', 'Tom', 'Apple', 6830], ['East', 'Tom', 'Apple', 6830],
['East', 'Fritz', 'Apple', 4394], ['East', 'Fritz', 'Apple', 4394],
['South', 'Sal', 'Apple', 1310], ['South', 'Sal', 'Apple', 1310],
['South', 'Hector', 'Apple', 98144], ['South', 'Hector', 'Apple', 8144],
]; ];
$result = Filter::filter($this->sampleDataForRow(), $criteria); $result = Filter::filter($this->sampleDataForRow(), $criteria);
self::assertSame($expectedResult, $result); self::assertSame($expectedResult, $result);
@ -70,7 +70,7 @@ class FilterTest extends TestCase
['East', 'Fritz', 'Banana', 6274], ['East', 'Fritz', 'Banana', 6274],
['West', 'Sravan', 'Pear', 4894], ['West', 'Sravan', 'Pear', 4894],
['North', 'Xi', 'Grape', 7580], ['North', 'Xi', 'Grape', 7580],
['South', 'Hector', 'Apple', 98144], ['South', 'Hector', 'Apple', 8144],
]; ];
} }