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);
|
||||
$vmlCommentsFile = simplexml_load_string(
|
||||
$this->securityScanner->scan($this->getFromZipArchive($zip, $relPath)),
|
||||
'SimpleXMLElement',
|
||||
Settings::getLibXmlLoaderOptions()
|
||||
);
|
||||
$vmlCommentsFile->registerXPathNamespace('v', 'urn:schemas-microsoft-com:vml');
|
||||
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) {
|
||||
|
|
|
@ -33,6 +33,16 @@ class XlsxTest extends TestCase
|
|||
$this->assertEquals($ref, \array_slice($data[$i], 0, 10, true));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
|
|
Binary file not shown.
Loading…
Reference in New Issue