PHP 8.2.3 on my dev wiki
Using Special:Import gives Import failed: XML error at line 1: Validation failed: no DTD found !
Not sure if it's a bad export or a problematic import..
"Import from another wiki" similarly broken...
Reedy | |
Feb 24 2023, 2:37 AM |
F36867362: Wikipedia-20230224023323.xml | |
Feb 24 2023, 2:37 AM |
PHP 8.2.3 on my dev wiki
Using Special:Import gives Import failed: XML error at line 1: Validation failed: no DTD found !
Not sure if it's a bad export or a problematic import..
"Import from another wiki" similarly broken...
Seems to be caused by rMW771219475e11: import: Add a syntax check for xml imports by @Umherirrender.
Top of the backtrace...
/var/www/wiki/mediawiki/core/includes/specials/SpecialImport.php:244: object(MWException)[999] protected 'message' => string 'XML error at line 1: Validation failed: no DTD found !' (length=54) private string 'string' (Exception) => string '' (length=0) protected 'code' => int 0 protected string 'file' => string '/var/www/wiki/mediawiki/core/includes/import/WikiImporter.php' (length=61) protected int 'line' => int 1372 private array 'trace' (Exception) => array (size=10) 0 => array (size=5) 'file' => string '/var/www/wiki/mediawiki/core/includes/import/WikiImporter.php' (length=61) 'line' => int 694 'function' => string 'syntaxCheckXML' (length=14) 'class' => string 'WikiImporter' (length=12) 'type' => string '->' (length=2) 1 => array (size=5) 'file' => string '/var/www/wiki/mediawiki/core/includes/specials/SpecialImport.php' (length=64) 'line' => int 239 'function' => string 'doImport' (length=8) 'class' => string 'WikiImporter' (length=12) 'type' => string '->' (length=2) 2 => array (size=5) 'file' => string '/var/www/wiki/mediawiki/core/includes/specials/SpecialImport.php' (length=64) 'line' => int 112 'function' => string 'doImport' (length=8) 'class' => string 'SpecialImport' (length=13) 'type' => string '->' (length=2) 3 => array (size=5) 'file' => string '/var/www/wiki/mediawiki/core/includes/specialpage/SpecialPage.php' (length=65) 'line' => int 700 'function' => string 'execute' (length=7) 'class' => string 'SpecialImport' (length=13) 'type' => string '->' (length=2) 4 => array (size=5) 'file' => string '/var/www/wiki/mediawiki/core/includes/specialpage/SpecialPageFactory.php' (length=72) 'line' => int 1463 'function' => string 'run' (length=3) 'class' => string 'SpecialPage' (length=11) 'type' => string '->' (length=2) 5 => array (size=5) 'file' => string '/var/www/wiki/mediawiki/core/includes/MediaWiki.php' (length=51) 'line' => int 324 'function' => string 'executePath' (length=11) 'class' => string 'MediaWiki\SpecialPage\SpecialPageFactory' (length=40) 'type' => string '->' (length=2) 6 => array (size=5) 'file' => string '/var/www/wiki/mediawiki/core/includes/MediaWiki.php' (length=51) 'line' => int 917 'function' => string 'performRequest' (length=14) 'class' => string 'MediaWiki' (length=9) 'type' => string '->' (length=2) 7 => array (size=5) 'file' => string '/var/www/wiki/mediawiki/core/includes/MediaWiki.php' (length=51) 'line' => int 573 'function' => string 'main' (length=4) 'class' => string 'MediaWiki' (length=9) 'type' => string '->' (length=2) 8 => array (size=5) 'file' => string '/var/www/wiki/mediawiki/core/index.php' (length=38) 'line' => int 50 'function' => string 'run' (length=3) 'class' => string 'MediaWiki' (length=9) 'type' => string '->' (length=2) 9 => array (size=3) 'file' => string '/var/www/wiki/mediawiki/core/index.php' (length=38) 'line' => int 46 'function' => string 'wfIndexMain' (length=11) private ?Throwable 'previous' (Exception) => null public 'xdebug_message' => string '<tr><th align='left' bgcolor='#f57900' colspan="5"><span style='background-color: #cc0000; color: #fce94f; font-size: x-large;'>( ! )</span> MWException: XML error at line 1: Validation failed: no DTD found ! in /var/www/wiki/mediawiki/core/includes/import/WikiImporter.php on line <i>1372</i></th></tr> <tr><th align='left' bgcolor='#e9b96e' colspan='5'>Call Stack</th></tr> <tr><th align='center' bgcolor='#eeeeec'>#</th><th align='left' bgcolor='#eeeeec'>Time</th><th align='left' bgcolor='#eeeeec'>Memory</th'... (length=12300)
If I revert the commit, the import works...
@Reedy What version of ibxml2 is your PHP 8.2.16 using, compared to 8.1.16? Maybe something changed regarding entity loading between the two respective versions?
Seemingly the same...
reedy@ubuntu64-web-esxi:~$ php8.1 -a Interactive shell php > echo LIBXML_DOTTED_VERSION; 2.9.14 php > ^Dreedy@ubuntu64-web-esxi:~$ php8.2 -a Interactive shell php > echo LIBXML_DOTTED_VERSION; 2.9.14 php > ^Dreedy@ubuntu64-web-esxi:~$ php8.0 -a Interactive mode enabled php > echo LIBXML_DOTTED_VERSION; 2.9.14
I will also note that I don't remember if I've tried an XML import to my dev wiki since I switched it to PHP 8.2; so it's possible this may have been the case since 8.2.0, or it could be new in 8.2.3.
Could do with deciding what to do about this... Revert out of 1.40, pending a fix in master?
Change 931710 had a related patch set uploaded (by Reedy; author: Reedy):
[mediawiki/core@master] Revert "import: Add a syntax check for xml imports"
Change 931711 had a related patch set uploaded (by Reedy; author: Reedy):
[mediawiki/core@REL1_40] Revert "import: Add a syntax check for xml imports"
PHP 8.2.7 seems to work fine for me now, even though no change in the major libxml version...
php > echo LIBXML_DOTTED_VERSION; 2.9.14 php >
ii libxml2:amd64 2.9.14+dfsg-0.1+ubuntu22.04.1+deb.sury.org+1 amd64 GNOME XML library
It's entirely possible it was fixed between 8.2.3 being released and 8.2.7... Whether a PHP bug or a sury related packaging (dependant library) issue.
https://github.com/php/php-src/compare/php-8.2.3...php-8.2.7
Would be nice to know, especially if there's "good reason" we should add some versions less than 8.2.7 as a "known bad" version in PHPVersionCheck.
I suspect, though, as it's working on the latest patch release of the branch, there's no reason to actually merge the revert.
Change 931710 abandoned by Reedy:
[mediawiki/core@master] Revert "import: Add a syntax check for xml imports"
Reason:
PHP 8.2.3 didn't work, PHP 8.2.7 seems to...
Change 931711 abandoned by Reedy:
[mediawiki/core@REL1_40] Revert "import: Add a syntax check for xml imports"
Reason:
PHP 8.2.3 didn't work, PHP 8.2.7 seems to...
I was able to reproduce this with the current php8.2 ondrej package (8.2.7).
The bug only occurs when tideways_xhprof is enabled.
I filed https://github.com/php/php-src/issues/11548
A workaround is to call XMLReader::open() statically.
Change 933699 had a related patch set uploaded (by Tim Starling; author: Tim Starling):
[mediawiki/core@master] Work around argument corruption bug in XMLReader::open
Change 933699 merged by jenkins-bot:
[mediawiki/core@master] Work around argument corruption bug in XMLReader::open
Change 933644 had a related patch set uploaded (by Reedy; author: Tim Starling):
[mediawiki/core@REL1_40] Work around argument corruption bug in XMLReader::open
Change 933645 had a related patch set uploaded (by Reedy; author: Tim Starling):
[mediawiki/core@REL1_39] Work around argument corruption bug in XMLReader::open
Change 934006 had a related patch set uploaded (by Reedy; author: Tim Starling):
[mediawiki/core@REL1_38] Work around argument corruption bug in XMLReader::open
Change 934007 had a related patch set uploaded (by Reedy; author: Tim Starling):
[mediawiki/core@REL1_35] Work around argument corruption bug in XMLReader::open
Change 933644 merged by jenkins-bot:
[mediawiki/core@REL1_40] Work around argument corruption bug in XMLReader::open
Change 934007 merged by jenkins-bot:
[mediawiki/core@REL1_35] Work around argument corruption bug in XMLReader::open
Change 934006 merged by jenkins-bot:
[mediawiki/core@REL1_38] Work around argument corruption bug in XMLReader::open
Change 933645 merged by jenkins-bot:
[mediawiki/core@REL1_39] Work around argument corruption bug in XMLReader::open