File tree 2 files changed +18
-9
lines changed 2 files changed +18
-9
lines changed Original file line number Diff line number Diff line change @@ -199,7 +199,9 @@ public function testLoadEmptyXmlFile()
199
199
// test for issue https://github.com/symfony/symfony/issues/9731
200
200
public function testLoadWrongEmptyXMLWithErrorHandler ()
201
201
{
202
- $ originalDisableEntities = libxml_disable_entity_loader (false );
202
+ if (LIBXML_VERSION < 20900 ) {
203
+ $ originalDisableEntities = libxml_disable_entity_loader (false );
204
+ }
203
205
$ errorReporting = error_reporting (-1 );
204
206
205
207
set_error_handler (function ($ errno , $ errstr ) {
@@ -219,12 +221,13 @@ public function testLoadWrongEmptyXMLWithErrorHandler()
219
221
error_reporting ($ errorReporting );
220
222
}
221
223
222
- $ disableEntities = libxml_disable_entity_loader (true );
223
- libxml_disable_entity_loader ($ disableEntities );
224
-
225
- libxml_disable_entity_loader ($ originalDisableEntities );
224
+ if (LIBXML_VERSION < 20900 ) {
225
+ $ disableEntities = libxml_disable_entity_loader (true );
226
+ libxml_disable_entity_loader ($ disableEntities );
226
227
227
- $ this ->assertFalse ($ disableEntities );
228
+ libxml_disable_entity_loader ($ originalDisableEntities );
229
+ $ this ->assertFalse ($ disableEntities );
230
+ }
228
231
229
232
// should not throw an exception
230
233
XmlUtils::loadFile (__DIR__ .'/../Fixtures/Util/valid.xml ' , __DIR__ .'/../Fixtures/Util/schema.xsd ' );
Original file line number Diff line number Diff line change @@ -51,21 +51,27 @@ public static function parse($content, $schemaOrCallable = null)
51
51
}
52
52
53
53
$ internalErrors = libxml_use_internal_errors (true );
54
- $ disableEntities = libxml_disable_entity_loader (true );
54
+ if (LIBXML_VERSION < 20900 ) {
55
+ $ disableEntities = libxml_disable_entity_loader (true );
56
+ }
55
57
libxml_clear_errors ();
56
58
57
59
$ dom = new \DOMDocument ();
58
60
$ dom ->validateOnParse = true ;
59
61
if (!$ dom ->loadXML ($ content , LIBXML_NONET | (\defined ('LIBXML_COMPACT ' ) ? LIBXML_COMPACT : 0 ))) {
60
- libxml_disable_entity_loader ($ disableEntities );
62
+ if (LIBXML_VERSION < 20900 ) {
63
+ libxml_disable_entity_loader ($ disableEntities );
64
+ }
61
65
62
66
throw new XmlParsingException (implode ("\n" , static ::getXmlErrors ($ internalErrors )));
63
67
}
64
68
65
69
$ dom ->normalizeDocument ();
66
70
67
71
libxml_use_internal_errors ($ internalErrors );
68
- libxml_disable_entity_loader ($ disableEntities );
72
+ if (LIBXML_VERSION < 20900 ) {
73
+ libxml_disable_entity_loader ($ disableEntities );
74
+ }
69
75
70
76
foreach ($ dom ->childNodes as $ child ) {
71
77
if (XML_DOCUMENT_TYPE_NODE === $ child ->nodeType ) {
You can’t perform that action at this time.
0 commit comments