1717use PhpOffice \PhpSpreadsheet \Reader \Ods \Properties as DocumentProperties ;
1818use PhpOffice \PhpSpreadsheet \Reader \Security \XmlScanner ;
1919use PhpOffice \PhpSpreadsheet \RichText \RichText ;
20- use PhpOffice \PhpSpreadsheet \Settings ;
2120use PhpOffice \PhpSpreadsheet \Shared \Date ;
2221use PhpOffice \PhpSpreadsheet \Shared \File ;
2322use PhpOffice \PhpSpreadsheet \Spreadsheet ;
@@ -58,9 +57,12 @@ public function canRead(string $filename): bool
5857 $ mimeType = $ zip ->getFromName ($ stat ['name ' ]);
5958 } elseif ($ zip ->statName ('META-INF/manifest.xml ' )) {
6059 $ xml = simplexml_load_string (
61- $ this ->getSecurityScannerOrThrow ()->scan ($ zip ->getFromName ('META-INF/manifest.xml ' )),
62- 'SimpleXMLElement ' ,
63- Settings::getLibXmlLoaderOptions ()
60+ $ this ->getSecurityScannerOrThrow ()
61+ ->scan (
62+ $ zip ->getFromName (
63+ 'META-INF/manifest.xml '
64+ )
65+ )
6466 );
6567 if ($ xml !== false ) {
6668 $ namespacesContent = $ xml ->getNamespaces (true );
@@ -98,9 +100,10 @@ public function listWorksheetNames(string $filename): array
98100
99101 $ xml = new XMLReader ();
100102 $ xml ->xml (
101- $ this ->getSecurityScannerOrThrow ()->scanFile ('zip:// ' . realpath ($ filename ) . '# ' . self ::INITIAL_FILE ),
102- null ,
103- Settings::getLibXmlLoaderOptions ()
103+ $ this ->getSecurityScannerOrThrow ()
104+ ->scanFile (
105+ 'zip:// ' . realpath ($ filename ) . '# ' . self ::INITIAL_FILE
106+ )
104107 );
105108 $ xml ->setParserProperty (2 , true );
106109
@@ -145,9 +148,10 @@ public function listWorksheetInfo(string $filename): array
145148
146149 $ xml = new XMLReader ();
147150 $ xml ->xml (
148- $ this ->getSecurityScannerOrThrow ()->scanFile ('zip:// ' . realpath ($ filename ) . '# ' . self ::INITIAL_FILE ),
149- null ,
150- Settings::getLibXmlLoaderOptions ()
151+ $ this ->getSecurityScannerOrThrow ()
152+ ->scanFile (
153+ 'zip:// ' . realpath ($ filename ) . '# ' . self ::INITIAL_FILE
154+ )
151155 );
152156 $ xml ->setParserProperty (2 , true );
153157
@@ -254,9 +258,8 @@ public function loadIntoExisting(string $filename, Spreadsheet $spreadsheet): Sp
254258 // Meta
255259
256260 $ xml = @simplexml_load_string (
257- $ this ->getSecurityScannerOrThrow ()->scan ($ zip ->getFromName ('meta.xml ' )),
258- 'SimpleXMLElement ' ,
259- Settings::getLibXmlLoaderOptions ()
261+ $ this ->getSecurityScannerOrThrow ()
262+ ->scan ($ zip ->getFromName ('meta.xml ' ))
260263 );
261264 if ($ xml === false ) {
262265 throw new Exception ('Unable to read data from {$pFilename} ' );
@@ -270,8 +273,8 @@ public function loadIntoExisting(string $filename, Spreadsheet $spreadsheet): Sp
270273
271274 $ dom = new DOMDocument ('1.01 ' , 'UTF-8 ' );
272275 $ dom ->loadXML (
273- $ this ->getSecurityScannerOrThrow ()-> scan ( $ zip -> getFromName ( ' styles.xml ' )),
274- Settings:: getLibXmlLoaderOptions ( )
276+ $ this ->getSecurityScannerOrThrow ()
277+ -> scan ( $ zip -> getFromName ( ' styles.xml ' ) )
275278 );
276279
277280 $ pageSettings = new PageSettings ($ dom );
@@ -280,8 +283,8 @@ public function loadIntoExisting(string $filename, Spreadsheet $spreadsheet): Sp
280283
281284 $ dom = new DOMDocument ('1.01 ' , 'UTF-8 ' );
282285 $ dom ->loadXML (
283- $ this ->getSecurityScannerOrThrow ()-> scan ( $ zip -> getFromName ( self :: INITIAL_FILE )),
284- Settings:: getLibXmlLoaderOptions ( )
286+ $ this ->getSecurityScannerOrThrow ()
287+ -> scan ( $ zip -> getFromName ( self :: INITIAL_FILE ) )
285288 );
286289
287290 $ officeNs = (string ) $ dom ->lookupNamespaceUri ('office ' );
@@ -690,8 +693,8 @@ private function processSettings(ZipArchive $zip, Spreadsheet $spreadsheet): voi
690693 {
691694 $ dom = new DOMDocument ('1.01 ' , 'UTF-8 ' );
692695 $ dom ->loadXML (
693- $ this ->getSecurityScannerOrThrow ()-> scan ( $ zip -> getFromName ( ' settings.xml ' )),
694- Settings:: getLibXmlLoaderOptions ( )
696+ $ this ->getSecurityScannerOrThrow ()
697+ -> scan ( $ zip -> getFromName ( ' settings.xml ' ) )
695698 );
696699 //$xlinkNs = $dom->lookupNamespaceUri('xlink');
697700 $ configNs = (string ) $ dom ->lookupNamespaceUri ('config ' );
0 commit comments