Page MenuHomePhabricator

Error: Bad regular expression
Closed, ResolvedPublicPRODUCTION ERROR

Description

Error
normalized_message
[{reqId}] {exception_url}   Error: Bad regular expression
exception.trace
from /srv/mediawiki/php-1.37.0-wmf.12/vendor/wikimedia/parsoid/src/Html2Wt/ConstrainedText/ConstrainedText.php(179)
#0 /srv/mediawiki/php-1.37.0-wmf.12/vendor/wikimedia/parsoid/src/Html2Wt/SerializerState.php(688): Wikimedia\Parsoid\Html2Wt\ConstrainedText\ConstrainedText->matches(string, Wikimedia\Parsoid\Config\Env)
#1 /srv/mediawiki/php-1.37.0-wmf.12/vendor/wikimedia/parsoid/src/Html2Wt/WikitextSerializer.php(1198): Wikimedia\Parsoid\Html2Wt\SerializerState->emitChunk(Wikimedia\Parsoid\Html2Wt\ConstrainedText\ConstrainedText, DOMElement)
#2 [internal function]: Wikimedia\Parsoid\Html2Wt\WikitextSerializer->serializeDOMNode(DOMElement, Wikimedia\Parsoid\Html2Wt\DOMHandlers\PHandler)
#3 /srv/mediawiki/php-1.37.0-wmf.12/vendor/wikimedia/parsoid/src/Html2Wt/WikitextSerializer.php(1332): call_user_func(array, DOMElement, Wikimedia\Parsoid\Html2Wt\DOMHandlers\PHandler)
#4 /srv/mediawiki/php-1.37.0-wmf.12/vendor/wikimedia/parsoid/src/Html2Wt/SerializerState.php(715): Wikimedia\Parsoid\Html2Wt\WikitextSerializer->serializeNode(DOMElement)
#5 /srv/mediawiki/php-1.37.0-wmf.12/vendor/wikimedia/parsoid/src/Html2Wt/SerializerState.php(741): Wikimedia\Parsoid\Html2Wt\SerializerState->serializeChildren(DOMElement, NULL)
#6 /srv/mediawiki/php-1.37.0-wmf.12/vendor/wikimedia/parsoid/src/Html2Wt/WikitextSerializer.php(1599): Wikimedia\Parsoid\Html2Wt\SerializerState->kickOffSerialize(DOMElement)
#7 /srv/mediawiki/php-1.37.0-wmf.12/vendor/wikimedia/parsoid/src/Html2Wt/SelectiveSerializer.php(236): Wikimedia\Parsoid\Html2Wt\WikitextSerializer->serializeDOM(DOMElement, boolean)
#8 /srv/mediawiki/php-1.37.0-wmf.12/vendor/wikimedia/parsoid/src/Core/WikitextContentModelHandler.php(168): Wikimedia\Parsoid\Html2Wt\SelectiveSerializer->serializeDOM(DOMDocument)
#9 /srv/mediawiki/php-1.37.0-wmf.12/vendor/wikimedia/parsoid/src/Parsoid.php(280): Wikimedia\Parsoid\Core\WikitextContentModelHandler->fromDOM(Wikimedia\Parsoid\Config\Env, Wikimedia\Parsoid\Core\SelserData)
#10 /srv/mediawiki/php-1.37.0-wmf.12/vendor/wikimedia/parsoid/extension/src/Rest/Handler/ParsoidHandler.php(827): Wikimedia\Parsoid\Parsoid->dom2wikitext(MWParsoid\Config\PageConfig, DOMDocument, array, Wikimedia\Parsoid\Core\SelserData)
#11 /srv/mediawiki/php-1.37.0-wmf.12/vendor/wikimedia/parsoid/extension/src/Rest/Handler/TransformHandler.php(133): MWParsoid\Rest\Handler\ParsoidHandler->html2wt(MWParsoid\Config\PageConfig, array, string)
#12 /srv/mediawiki/php-1.37.0-wmf.12/includes/Rest/Router.php(395): MWParsoid\Rest\Handler\TransformHandler->execute()
#13 /srv/mediawiki/php-1.37.0-wmf.12/includes/Rest/Router.php(322): MediaWiki\Rest\Router->executeHandler(MWParsoid\Rest\Handler\TransformHandler)
#14 /srv/mediawiki/php-1.37.0-wmf.12/includes/Rest/EntryPoint.php(165): MediaWiki\Rest\Router->execute(MediaWiki\Rest\RequestFromGlobals)
#15 /srv/mediawiki/php-1.37.0-wmf.12/includes/Rest/EntryPoint.php(130): MediaWiki\Rest\EntryPoint->execute()
#16 /srv/mediawiki/php-1.37.0-wmf.12/rest.php(31): MediaWiki\Rest\EntryPoint::main()
#17 /srv/mediawiki/w/rest.php(3): require(string)
#18 {main}
Impact
Notes

Event Timeline

preg_last_error: 2 corresponds to PREG_BACKTRACK_LIMIT_ERROR

Huh .. looks like the whole page got pulled into the regexp or something unless i am misreading that log.

$env->log( 'error', $error_msg, $re, $this->text );

Tangential, but an interesting tidbit here is |__(?:(?i:__GEENINHOUD__|__NOTOC__|.... Doesn't look like that will ever match because of the outer __

The base regex uses synonyms (aliases) which include the double underscores,
https://github.com/wikimedia/mediawiki/blob/master/includes/MagicWordArray.php#L116

but we don't expect that,
https://github.com/wikimedia/parsoid/blob/master/src/Mocks/MockSiteConfig.php#L106-L113

Change 705012 had a related patch set uploaded (by Arlolra; author: Arlolra):

[mediawiki/services/parsoid@master] Strip the double underscores from the extension bswRegexp

https://gerrit.wikimedia.org/r/705012

Change 705012 merged by jenkins-bot:

[mediawiki/services/parsoid@master] Strip the double underscores from the extension bswRegexp

https://gerrit.wikimedia.org/r/705012

Change 705032 had a related patch set uploaded (by Arlolra; author: Arlolra):

[mediawiki/services/parsoid@master] [WIP] Fix bad regular expression

https://gerrit.wikimedia.org/r/705032

Arlolra triaged this task as Medium priority.
Arlolra moved this task from Needs Triage to Bugs & Crashers on the Parsoid board.

Change 705497 had a related patch set uploaded (by Subramanya Sastry; author: Subramanya Sastry):

[mediawiki/vendor@master] Bump wikimedia/parsoid to 0.14.0-a8

https://gerrit.wikimedia.org/r/705497

Change 705497 merged by jenkins-bot:

[mediawiki/vendor@master] Bump wikimedia/parsoid to 0.14.0-a8

https://gerrit.wikimedia.org/r/705497

Change 705032 merged by jenkins-bot:

[mediawiki/services/parsoid@master] Fix backtracking in solRegexp

https://gerrit.wikimedia.org/r/705032

Change 708134 had a related patch set uploaded (by Subramanya Sastry; author: C. Scott Ananian):

[mediawiki/vendor@master] Bump wikimedia/parsoid to 0.14.0-a9

https://gerrit.wikimedia.org/r/708134

Change 708134 merged by jenkins-bot:

[mediawiki/vendor@master] Bump wikimedia/parsoid to 0.14.0-a9

https://gerrit.wikimedia.org/r/708134

Change 708172 had a related patch set uploaded (by Subramanya Sastry; author: Subramanya Sastry):

[mediawiki/vendor@master] Bump wikimedia/parsoid to 0.14.0-a10

https://gerrit.wikimedia.org/r/708172

Change 708172 merged by jenkins-bot:

[mediawiki/vendor@master] Bump wikimedia/parsoid to 0.14.0-a10

https://gerrit.wikimedia.org/r/708172