Page MenuHomePhabricator

Provide option to use XML_PARSE_HUGE to avoid: Error: DOMDocument::loadXML(): Excessive depth in document: 256
Closed, ResolvedPublic

Description

Author: qli

Description:
It's how the error shows

I had built a Wiki in my computer and used the data dumps of January 21th.
The soft enviroment is WampSever(php 5.3.0,Apache 2.2.11,Mysql 5.1.36).
The version of my mediawiki is 1.15.1 ,no extension and the $wgLanguageCode = "zh-hans".
I use mwdumper.jar and the command of "java -jar mwdumper.jar --format=sql:1.5 zhwiki-20100121-pages-articles.xml.bz2 | mysql -u wikiuser -p wikidb" to import the data.
Every time when i finish importing the data and change

[mysqld]

  max_allowed_packet = 128M
  innodb_log_file_size = 100M
  [mysql]
  max_allowed_packet = 128M
  
  max_execution_time = 300
in php.ini. And set $wgShowExceptionDetails = true;
I search the Template::Babel(In chinese 模板:Babel) in my localwiki. It always shows the error:

Warning: DOMDocument::loadXML() [domdocument.loadxml]: Excessive depth in document: 256 use XML_PARSE_HUGE option in Entity, line: 256 in D:\wamp\www\mediawiki\includes\parser\Preprocessor_DOM.php on line 107

Warning: DOMDocument::loadXML() [domdocument.loadxml]: Extra content at the end of the document in Entity, line: 256 in D:\wamp\www\mediawiki\includes\parser\Preprocessor_DOM.php on line 107

Preprocessor_DOM::preprocessToObj generated invalid XML

Backtrace:

#0 D:\wamp\www\mediawiki\includes\parser\Parser.php(2579): Preprocessor_DOM->preprocessToObj('{| name="userbo...', 0)
#1 D:\wamp\www\mediawiki\includes\parser\Parser.php(2630): Parser->preprocessToDom('{| name="userbo...')
#2 D:\wamp\www\mediawiki\includes\parser\Parser.php(875): Parser->replaceVariables('{| name="userbo...')
#3 D:\wamp\www\mediawiki\includes\parser\Parser.php(327): Parser->internalParse('{| name="userbo...')
#4 [internal function]: Parser->parse('{| name="userbo...', Object(Title), Object(ParserOptions), true, true, 9779191)
#5 D:\wamp\www\mediawiki\includes\StubObject.php(58): call_user_func_array(Array, Array)
#6 D:\wamp\www\mediawiki\includes\StubObject.php(76): StubObject->_call('parse', Array)
#7 [internal function]: StubObject->__call('parse', Array)
#8 D:\wamp\www\mediawiki\includes\Article.php(3557): StubObject->parse('{| name="userbo...', Object(Title), Object(ParserOptions), true, true, 9779191)
#9 D:\wamp\www\mediawiki\includes\Article.php(979): Article->outputWikiText('{| name="userbo...')
#10 D:\wamp\www\mediawiki\includes\Wiki.php(450): Article->view()
#11 D:\wamp\www\mediawiki\includes\Wiki.php(63): MediaWiki->performAction(Object(OutputPage), Object(Article), Object(Title), Object(User), Object(WebRequest))
#12 D:\wamp\www\mediawiki\index.php(116): MediaWiki->initialize(Object(Title), Object(Article), Object(OutputPage), Object(User), Object(WebRequest))
#13 {main}

I tried three times in two computers.I don't know why.I encountered this error in 2009-01-30.


Version: unspecified
Severity: enhancement
OS: Windows XP
Platform: PC

Attached:

error.jpg (800×1 px, 123 KB)

Details

Reference
bz22356

Event Timeline

bzimport raised the priority of this task from to Low.Nov 21 2014, 10:48 PM
bzimport added a project: MediaWiki-Parser.
bzimport set Reference to bz22356.
bzimport added a subscriber: Unknown Object (MLST).

This was also asked in http://lists.wikimedia.org/pipermail/wikitech-l/2010-February/046738.html

This is PHP's XML parser opting out due to excessive nesting. Nothing that could be fixed in MediaWiki software.
Wondering if our datadumps could do something differently, though.

<andre__> wondering whether something could be fixed in creation of datadumps.
<^demon> Not really, no.
<^demon> We could possibly add an option to MW core to use XML_PARSE_HUGE, but you probably wouldn't want it on by default.

XML_PARSE_HUGE is passed everytime since r96655, so this should be fixed.