diff --git a/src/Spout/Reader/ODS/RowIterator.php b/src/Spout/Reader/ODS/RowIterator.php index 4051583..e85e4dd 100644 --- a/src/Spout/Reader/ODS/RowIterator.php +++ b/src/Spout/Reader/ODS/RowIterator.php @@ -131,13 +131,10 @@ class RowIterator implements IteratorInterface /** * Returns whether we need data for the next row to be processed. - * We don't need to read data if: - * we have already read at least one row - * AND - * we need to preserve empty rows - * AND - * the last row that was read is not the row that need to be processed - * (i.e. if we need to return empty rows) + * We DO need to read data if: + * - we have not read any rows yet + * OR + * - the next row to be processed immediately follows the last read row * * @return bool Whether we need data for the next row to be processed. */ @@ -147,7 +144,6 @@ class RowIterator implements IteratorInterface return ( !$hasReadAtLeastOneRow || - !$this->shouldPreserveEmptyRows || $this->lastRowIndexProcessed === $this->nextRowIndexToBeProcessed - 1 ); } diff --git a/tests/Spout/Reader/ODS/ReaderTest.php b/tests/Spout/Reader/ODS/ReaderTest.php index d8ec39b..77fd3d6 100644 --- a/tests/Spout/Reader/ODS/ReaderTest.php +++ b/tests/Spout/Reader/ODS/ReaderTest.php @@ -78,6 +78,19 @@ class ReaderTest extends \PHPUnit_Framework_TestCase $this->assertEquals([['foo']], $allRows); } + /** + * @return void + */ + public function testReadShouldSupportNumberRowsRepeated() + { + $allRows = $this->getAllRowsForFile('sheet_with_number_rows_repeated.ods'); + $expectedRows = [ + ['foo', 10.43], + ['foo', 10.43], + ]; + $this->assertEquals($expectedRows, $allRows); + } + /** * @return void */ diff --git a/tests/resources/ods/sheet_with_number_rows_repeated.ods b/tests/resources/ods/sheet_with_number_rows_repeated.ods new file mode 100644 index 0000000..450148f Binary files /dev/null and b/tests/resources/ods/sheet_with_number_rows_repeated.ods differ