Merge pull request #21 from box/fix_empty_shared_string_bug
Fix empty shared string bug
This commit is contained in:
commit
a538813827
@ -257,7 +257,7 @@ class SharedStringsHelper
|
||||
$sharedString = $this->unescapeLineFeed($escapedSharedString);
|
||||
}
|
||||
|
||||
if (!$sharedString) {
|
||||
if ($sharedString === null) {
|
||||
throw new SharedStringNotFoundException("Shared string not found for index: $sharedStringIndex");
|
||||
}
|
||||
|
||||
|
@ -140,6 +140,19 @@ class XLSXTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertEquals($expectedRows, $allRows);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function testReadShouldSupportEmptySharedString()
|
||||
{
|
||||
$allRows = $this->getAllRowsForFile('sheet_with_empty_shared_string.xlsx');
|
||||
|
||||
$expectedRows = [
|
||||
['s1--A1', '', 's1--C1'],
|
||||
];
|
||||
$this->assertEquals($expectedRows, $allRows);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
|
BIN
tests/resources/xlsx/sheet_with_empty_shared_string.xlsx
Normal file
BIN
tests/resources/xlsx/sheet_with_empty_shared_string.xlsx
Normal file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user