Fix failure when parsing xlsx with drawing having double (redefined) … (#945)
* Fix failure when parsing xlsx with drawing having double (redefined) attributes * Fix failure when parsing xlsx with drawing having double (redefined) attributes
This commit is contained in:
parent
53ac682ba7
commit
906bdc613c
|
@ -1419,12 +1419,17 @@ class Xlsx extends BaseReader
|
|||
foreach ($vmlComments as $relName => $relPath) {
|
||||
// Load VML comments file
|
||||
$relPath = File::realpath(dirname("$dir/$fileWorksheet") . '/' . $relPath);
|
||||
try {
|
||||
$vmlCommentsFile = simplexml_load_string(
|
||||
$this->securityScanner->scan($this->getFromZipArchive($zip, $relPath)),
|
||||
'SimpleXMLElement',
|
||||
Settings::getLibXmlLoaderOptions()
|
||||
);
|
||||
$vmlCommentsFile->registerXPathNamespace('v', 'urn:schemas-microsoft-com:vml');
|
||||
} catch(\Throwable $ex) {
|
||||
//Ignore unparsable vmlDrawings. Later they will be moved from $unparsedVmlDrawings to $unparsedLoadedData
|
||||
continue;
|
||||
}
|
||||
|
||||
$shapes = $vmlCommentsFile->xpath('//v:shape');
|
||||
foreach ($shapes as $shape) {
|
||||
|
|
|
@ -34,6 +34,16 @@ class XlsxTest extends TestCase
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Test load Xlsx file with drawing having double attributes.
|
||||
*/
|
||||
public function testLoadXlsxWithDoubleAttrDrawing()
|
||||
{
|
||||
$filename = './data/Reader/XLSX/double_attr_drawing.xlsx';
|
||||
$reader = new Xlsx();
|
||||
$reader->load($filename);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test correct save and load xlsx files with empty drawings.
|
||||
* Such files can be generated by Google Sheets.
|
||||
|
|
Binary file not shown.
Loading…
Reference in New Issue