File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -181,16 +181,23 @@ protected function parseOptions(\SimpleXMLElement $nodes)
181181 protected function parseFile ($ file )
182182 {
183183 $ internalErrors = libxml_use_internal_errors (true );
184+ $ disableEntities = libxml_disable_entity_loader (true );
184185 libxml_clear_errors ();
185186
186187 $ dom = new \DOMDocument ();
187188 $ dom ->validateOnParse = true ;
188- if (!$ dom ->load ($ file , LIBXML_NONET | (defined ('LIBXML_COMPACT ' ) ? LIBXML_COMPACT : 0 ))) {
189+ if (!$ dom ->loadXML (file_get_contents ($ file ), LIBXML_NONET | (defined ('LIBXML_COMPACT ' ) ? LIBXML_COMPACT : 0 ))) {
190+ libxml_disable_entity_loader ($ disableEntities );
191+
189192 throw new MappingException (implode ("\n" , $ this ->getXmlErrors ($ internalErrors )));
190193 }
194+
195+ libxml_disable_entity_loader ($ disableEntities );
196+
191197 if (!$ dom ->schemaValidate (__DIR__ .'/schema/dic/constraint-mapping/constraint-mapping-1.0.xsd ' )) {
192198 throw new MappingException (implode ("\n" , $ this ->getXmlErrors ($ internalErrors )));
193199 }
200+
194201 $ dom ->normalizeDocument ();
195202
196203 libxml_use_internal_errors ($ internalErrors );
You can’t perform that action at this time.
0 commit comments