From f366c0f257603334e6628fcaeaeabfa8ea6b8589 Mon Sep 17 00:00:00 2001 From: Alex Wright Date: Sun, 13 Dec 2020 15:29:18 +0100 Subject: [PATCH] Change how ReadFilters are interpreted --- .../Reader/Xlsx/ColumnAndRowAttributes.php | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/PhpSpreadsheet/Reader/Xlsx/ColumnAndRowAttributes.php b/src/PhpSpreadsheet/Reader/Xlsx/ColumnAndRowAttributes.php index 4134b2f1..8913d6e0 100644 --- a/src/PhpSpreadsheet/Reader/Xlsx/ColumnAndRowAttributes.php +++ b/src/PhpSpreadsheet/Reader/Xlsx/ColumnAndRowAttributes.php @@ -121,13 +121,16 @@ class ColumnAndRowAttributes extends BaseParserClass private function isFilteredColumn(IReadFilter $readFilter, $columnCoordinate, array $rowsAttributes) { + if (empty($rowAttributes)) { + return false; + } foreach ($rowsAttributes as $rowCoordinate => $rowAttributes) { - if (!$readFilter->readCell($columnCoordinate, $rowCoordinate, $this->worksheet->getTitle())) { - return true; + if ($readFilter->readCell($columnCoordinate, $rowCoordinate, $this->worksheet->getTitle())) { + return false; } } - return false; + return true; } private function readColumnAttributes(SimpleXMLElement $worksheetCols, $readDataOnly) @@ -173,13 +176,16 @@ class ColumnAndRowAttributes extends BaseParserClass private function isFilteredRow(IReadFilter $readFilter, $rowCoordinate, array $columnsAttributes) { + if (empty($columnAttributes)) { + return false; + } foreach ($columnsAttributes as $columnCoordinate => $columnAttributes) { - if (!$readFilter->readCell($columnCoordinate, $rowCoordinate, $this->worksheet->getTitle())) { - return true; + if ($readFilter->readCell($columnCoordinate, $rowCoordinate, $this->worksheet->getTitle())) { + return false; } } - return false; + return true; } private function readRowAttributes(SimpleXMLElement $worksheetRow, $readDataOnly)