File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -181,16 +181,23 @@ protected function parseOptions(\SimpleXMLElement $nodes)
181
181
protected function parseFile ($ file )
182
182
{
183
183
$ internalErrors = libxml_use_internal_errors (true );
184
+ $ disableEntities = libxml_disable_entity_loader (true );
184
185
libxml_clear_errors ();
185
186
186
187
$ dom = new \DOMDocument ();
187
188
$ 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
+
189
192
throw new MappingException (implode ("\n" , $ this ->getXmlErrors ($ internalErrors )));
190
193
}
194
+
195
+ libxml_disable_entity_loader ($ disableEntities );
196
+
191
197
if (!$ dom ->schemaValidate (__DIR__ .'/schema/dic/constraint-mapping/constraint-mapping-1.0.xsd ' )) {
192
198
throw new MappingException (implode ("\n" , $ this ->getXmlErrors ($ internalErrors )));
193
199
}
200
+
194
201
$ dom ->normalizeDocument ();
195
202
196
203
libxml_use_internal_errors ($ internalErrors );
You can’t perform that action at this time.
0 commit comments