Handle empty rows without E_WARNING when filling missing array indexes (#385)

In some cases, reading an XLSX file produce E_WARNING from the max()
call in the fillMissingArray() method. This commit fix the problem
by handling empty rows.
This commit is contained in:
Stian Liknes authored and Adrien Loison committed 2017-02-19 23:30:35 +13:00
1 parent 6f4ddb1569
commit 1ce931a424
2 files changed
+19 -5

No files matched your search

@@ -31,6 +31,9 @@ class CellHelper
*/
public static function fillMissingArrayIndexes($dataArray, $fillValue = '')
{
if (empty($dataArray)) {
return [];
}
$existingIndexes = array_keys($dataArray);
$newIndexes = array_fill_keys(range(0, max($existingIndexes)), $fillValue);