diff options
author | Reedy <reedy@wikimedia.org> | 2021-01-27 16:06:29 +0000 |
---|---|---|
committer | Reedy <reedy@wikimedia.org> | 2021-01-27 16:06:38 +0000 |
commit | 256e6ff0d928a76d7be2ae54f71253d400aef4fe (patch) | |
tree | 2ebf5fc5986fffede1eec8f2ba4afe5eb43912f2 /includes/import | |
parent | f406c5872e615ea959391593365d502a07370e16 (diff) | |
download | mediawikicore-256e6ff0d928a76d7be2ae54f71253d400aef4fe.tar.gz mediawikicore-256e6ff0d928a76d7be2ae54f71253d400aef4fe.zip |
Revert "Wrap libxml_disable_entity_loader() calls in version constraint"
This reverts commit a4c69bde130c6109086d555492adc1378b1ca29b.
Reason for revert: Needs a bit more thinking about
Bug: T268847
Change-Id: I82a7bb2a4ef15adc65717d5ba173c8f3cfb0644c
Diffstat (limited to 'includes/import')
-rw-r--r-- | includes/import/WikiImporter.php | 34 |
1 files changed, 11 insertions, 23 deletions
diff --git a/includes/import/WikiImporter.php b/includes/import/WikiImporter.php index 4566d0420be5..0b4930537766 100644 --- a/includes/import/WikiImporter.php +++ b/includes/import/WikiImporter.php @@ -73,11 +73,9 @@ class WikiImporter { } $id = UploadSourceAdapter::registerSource( $source ); - if ( LIBXML_VERSION < 20900 ) { - // Enable the entity loader, as it is needed for loading external URLs via - // XMLReader::open (T86036) - $oldDisable = libxml_disable_entity_loader( false ); - } + // Enable the entity loader, as it is needed for loading external URLs via + // XMLReader::open (T86036) + $oldDisable = libxml_disable_entity_loader( false ); if ( defined( 'LIBXML_PARSEHUGE' ) ) { $status = $this->reader->open( "uploadsource://$id", null, LIBXML_PARSEHUGE ); } else { @@ -85,15 +83,11 @@ class WikiImporter { } if ( !$status ) { $error = libxml_get_last_error(); - if ( LIBXML_VERSION < 20900 ) { - libxml_disable_entity_loader( $oldDisable ); - } + libxml_disable_entity_loader( $oldDisable ); throw new MWException( 'Encountered an internal error while initializing WikiImporter object: ' . $error->message ); } - if ( LIBXML_VERSION < 20900 ) { - libxml_disable_entity_loader( $oldDisable ); - } + libxml_disable_entity_loader( $oldDisable ); // Default callbacks $this->setPageCallback( [ $this, 'beforeImportPage' ] ); @@ -573,20 +567,16 @@ class WikiImporter { * @return bool */ public function doImport() { - if ( LIBXML_VERSION < 20900 ) { - // Calls to reader->read need to be wrapped in calls to - // libxml_disable_entity_loader() to avoid local file - // inclusion attacks (T48932). - $oldDisable = libxml_disable_entity_loader( true ); - } + // Calls to reader->read need to be wrapped in calls to + // libxml_disable_entity_loader() to avoid local file + // inclusion attacks (T48932). + $oldDisable = libxml_disable_entity_loader( true ); $rethrow = null; try { $this->reader->read(); if ( $this->reader->localName != 'mediawiki' ) { - if ( LIBXML_VERSION < 20900 ) { - libxml_disable_entity_loader( $oldDisable ); - } + libxml_disable_entity_loader( $oldDisable ); throw new MWException( "Expected <mediawiki> tag, got " . $this->reader->localName ); } @@ -635,9 +625,7 @@ class WikiImporter { } } } finally { - if ( LIBXML_VERSION < 20900 ) { - libxml_disable_entity_loader( $oldDisable ); - } + libxml_disable_entity_loader( $oldDisable ); $this->reader->close(); } |