Fix crash when using associative array with empty row
This commit is contained in:
parent
9ce77405e0
commit
c452fa1f31
@ -149,7 +149,8 @@ EOD;
|
|||||||
private function isEmptyRow($dataRow)
|
private function isEmptyRow($dataRow)
|
||||||
{
|
{
|
||||||
$numCells = count($dataRow);
|
$numCells = count($dataRow);
|
||||||
return ($numCells === 1 && CellHelper::isEmpty($dataRow[0]));
|
// using "reset()" instead of "$dataRow[0]" because $dataRow can be an associative array
|
||||||
|
return ($numCells === 1 && CellHelper::isEmpty(reset($dataRow)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -294,7 +294,7 @@ class WriterTest extends \PHPUnit_Framework_TestCase
|
|||||||
$dataRows = [
|
$dataRows = [
|
||||||
[''],
|
[''],
|
||||||
['xlsx--21', 'xlsx--22'],
|
['xlsx--21', 'xlsx--22'],
|
||||||
[''],
|
['key' => ''],
|
||||||
[''],
|
[''],
|
||||||
['xlsx--51', 'xlsx--52'],
|
['xlsx--51', 'xlsx--52'],
|
||||||
];
|
];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user