Cell indexes not being respected when rendering row

Fixes #682
When calling `Row::setCellIndex`, it's possible to create a Row with holes.
Instead of iterating over existing cells of a Row, we should instead use the cell indexes (from 0 to max cell index).
This commit is contained in:
Adrien Loison authored and Adrien Loison committed 2019-09-28 14:02:23 +00:00
1 parent 2d297e954b
commit 16a2f91a22
6 files changed
+65 -41

No files matched your search

@@ -47,12 +47,14 @@ class RowManager
*/
public function fillMissingIndexesWithEmptyCells(Row $row)
{
if ($row->getNumCells() === 0) {
$numCells = $row->getNumCells();
if ($numCells === 0) {
return $row;
}
$rowCells = $row->getCells();
$maxCellIndex = max(array_keys($rowCells));
$maxCellIndex = $numCells;
for ($cellIndex = 0; $cellIndex < $maxCellIndex; $cellIndex++) {
if (!isset($rowCells[$cellIndex])) {