Page MenuHomePhabricator

TypeError: Argument 1 passed to HookHandlers\ParserHooksHandler::mathTagHook() must be of the type string, null given
Closed, ResolvedPublicPRODUCTION ERROR

Description

List of steps to reproduce (step by step, including full links if applicable):

What happens?:

  • It returns: [5dd28909-878f-419b-b4a2-69ab76702b20] 2021-08-13 18:16:28: Fatal exception of type "TypeError"
  • History and Page info return ok
TypeError: Argument 1 passed to MediaWiki\Extension\Math\HookHandlers\ParserHooksHandler::mathTagHook() must be of the type string, null given, called in /srv/mediawiki/php-1.37.0-wmf.18/includes/parser/Parser.php on line 3966
exception.trace
from /srv/mediawiki/php-1.37.0-wmf.18/extensions/Math/src/HookHandlers/ParserHooksHandler.php(71)
#0 /srv/mediawiki/php-1.37.0-wmf.18/includes/parser/Parser.php(3966): MediaWiki\Extension\Math\HookHandlers\ParserHooksHandler->mathTagHook(NULL, array, Parser, PPFrame_Hash)
#1 /srv/mediawiki/php-1.37.0-wmf.18/includes/parser/PPFrame_Hash.php(351): Parser->extensionSubstitution(array, PPFrame_Hash)
#2 /srv/mediawiki/php-1.37.0-wmf.18/includes/parser/Parser.php(2923): PPFrame_Hash->expand(PPNode_Hash_Tree, integer)
#3 /srv/mediawiki/php-1.37.0-wmf.18/includes/parser/Parser.php(1591): Parser->replaceVariables(string)
#4 /srv/mediawiki/php-1.37.0-wmf.18/includes/parser/Parser.php(652): Parser->internalParse(string)
#5 /srv/mediawiki/php-1.37.0-wmf.18/includes/content/WikitextContent.php(345): Parser->parse(string, Title, ParserOptions, boolean, boolean, integer)
#6 /srv/mediawiki/php-1.37.0-wmf.18/includes/content/AbstractContent.php(540): WikitextContent->fillParserOutput(Title, integer, ParserOptions, boolean, ParserOutput)
#7 /srv/mediawiki/php-1.37.0-wmf.18/includes/Revision/RenderedRevision.php(266): AbstractContent->getParserOutput(Title, integer, ParserOptions, boolean)
#8 /srv/mediawiki/php-1.37.0-wmf.18/includes/Revision/RenderedRevision.php(235): MediaWiki\Revision\RenderedRevision->getSlotParserOutputUncached(WikitextContent, boolean)
#9 /srv/mediawiki/php-1.37.0-wmf.18/includes/Revision/RevisionRenderer.php(217): MediaWiki\Revision\RenderedRevision->getSlotParserOutput(string, array)
#10 /srv/mediawiki/php-1.37.0-wmf.18/includes/Revision/RevisionRenderer.php(154): MediaWiki\Revision\RevisionRenderer->combineSlotOutput(MediaWiki\Revision\RenderedRevision, array)
#11 [internal function]: MediaWiki\Revision\RevisionRenderer->MediaWiki\Revision\{closure}(MediaWiki\Revision\RenderedRevision, array)
#12 /srv/mediawiki/php-1.37.0-wmf.18/includes/Revision/RenderedRevision.php(197): call_user_func(Closure, MediaWiki\Revision\RenderedRevision, array)
#13 /srv/mediawiki/php-1.37.0-wmf.18/includes/poolcounter/PoolWorkArticleView.php(137): MediaWiki\Revision\RenderedRevision->getRevisionParserOutput()
#14 /srv/mediawiki/php-1.37.0-wmf.18/includes/poolcounter/PoolCounterWork.php(162): PoolWorkArticleView->doWork()
#15 /srv/mediawiki/php-1.37.0-wmf.18/includes/page/ParserOutputAccess.php(281): PoolCounterWork->execute()
#16 /srv/mediawiki/php-1.37.0-wmf.18/includes/page/Article.php(746): MediaWiki\Page\ParserOutputAccess->getParserOutput(WikiPage, ParserOptions, MediaWiki\Revision\RevisionStoreCacheRecord, integer)
#17 /srv/mediawiki/php-1.37.0-wmf.18/includes/page/Article.php(558): Article->generateContentOutput(User, ParserOptions, integer, OutputPage, array)
#18 /srv/mediawiki/php-1.37.0-wmf.18/includes/actions/ViewAction.php(74): Article->view()
#19 /srv/mediawiki/php-1.37.0-wmf.18/includes/MediaWiki.php(538): ViewAction->show()
#20 /srv/mediawiki/php-1.37.0-wmf.18/includes/MediaWiki.php(320): MediaWiki->performAction(Article, Title)
#21 /srv/mediawiki/php-1.37.0-wmf.18/includes/MediaWiki.php(925): MediaWiki->performRequest()
#22 /srv/mediawiki/php-1.37.0-wmf.18/includes/MediaWiki.php(559): MediaWiki->main()
#23 /srv/mediawiki/php-1.37.0-wmf.18/index.php(53): MediaWiki->run()
#24 /srv/mediawiki/php-1.37.0-wmf.18/index.php(46): wfIndexMain()
#25 /srv/mediawiki/w/index.php(3): require(string)
#26 {main}

Event Timeline

Aklapper changed the subtype of this task from "Bug Report" to "Production Error".Aug 13 2021, 6:16 PM
Aklapper renamed this task from Page in elwiki returns Fatal exception of type "TypeError" to TypeError: Argument 1 passed to HookHandlers\ParserHooksHandler::mathTagHook() must be of the type string, null given.Aug 13 2021, 6:23 PM
Aklapper updated the task description. (Show Details)
Aklapper added a project: Math.
Aklapper set Phatality ID to 0811a18f349c2a9b024aa29d914243256642910581a4a7780b3ef54918b4b918.

mmh. The error has the same source, but actually it's not really a duplicate as the function is called from different places.

Change 713002 had a related patch set uploaded (by Ppchelko; author: Ppchelko):

[mediawiki/extensions/Math@master] Support null content in parser tag hook

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

Change 713002 merged by jenkins-bot:

[mediawiki/extensions/Math@master] Support null content in parser tag hook

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

Change 712962 had a related patch set uploaded (by Lucas Werkmeister (WMDE); author: Ppchelko):

[mediawiki/extensions/Math@wmf/1.37.0-wmf.18] Support null content in parser tag hook

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

Change 712962 merged by jenkins-bot:

[mediawiki/extensions/Math@wmf/1.37.0-wmf.18] Support null content in parser tag hook

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

Mentioned in SAL (#wikimedia-operations) [2021-08-16T12:15:44Z] <lucaswerkmeister-wmde@deploy1002> Synchronized php-1.37.0-wmf.18/extensions/Math/src/HookHandlers/ParserHooksHandler.php: Backport: [[gerrit:712962|Support null content in parser tag hook (T288846)]] (hopefully also fixes T288790) (duration: 00m 59s)

Lucas_Werkmeister_WMDE assigned this task to Pchelolo.

As far as I can tell, this is fixed now.

The patch introduced a new problem. It treats 0 as null.

Maybe the workaround for T10372 is no longer needed.

If we would remove the bugfix it would show another error for math tags with width zero:

Screenshot from 2021-08-19 11-30-23.png (1×1 px, 275 KB)

Maybe it is better to fix that problem in mathoid.

Change 713823 had a related patch set uploaded (by Physikerwelt; author: Physikerwelt):

[mediawiki/services/mathoid@master] Handle zero width math tags

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

Change 713829 had a related patch set uploaded (by Physikerwelt; author: Physikerwelt):

[mediawiki/extensions/Math@master] Remove empty string workaround

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

@Lucas_Werkmeister_WMDE There is still one edge case <math>0</math> where the fix you backported causes problems. I can't judge how important that is in comparison to other current problems. However to me this seem something one should better fix sooner than later as people change the wikitext in order to workaround this problem. Therefore, I would be happy about a sooner code review in comparison to new features.

I think the <math>0</math> case is quite important, despite being easily worked around. Its incorrect rendering has been causing problems on multiple Wikipedia articles, including at least one featured article. It is a very natural formula that is likely to come up again repeatedly.

Change 713823 merged by jenkins-bot:

[mediawiki/services/mathoid@master] Handle zero width math tags

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

Change 713829 merged by jenkins-bot:

[mediawiki/extensions/Math@master] Allow rendering of <math>0</math>

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

Change 714853 had a related patch set uploaded (by Lucas Werkmeister (WMDE); author: Physikerwelt):

[mediawiki/extensions/Math@wmf/1.37.0-wmf.19] Allow rendering of <math>0</math>

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

Change 714854 had a related patch set uploaded (by Lucas Werkmeister (WMDE); author: Physikerwelt):

[mediawiki/extensions/Math@wmf/1.37.0-wmf.20] Allow rendering of <math>0</math>

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

Change 714854 merged by jenkins-bot:

[mediawiki/extensions/Math@wmf/1.37.0-wmf.20] Allow rendering of <math>0</math>

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

Change 714853 merged by jenkins-bot:

[mediawiki/extensions/Math@wmf/1.37.0-wmf.19] Allow rendering of <math>0</math>

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

Mentioned in SAL (#wikimedia-operations) [2021-08-26T11:35:48Z] <lucaswerkmeister-wmde@deploy1002> Synchronized php-1.37.0-wmf.20/extensions/Math/src/HookHandlers/ParserHooksHandler.php: Backport: [[gerrit:714854|Allow rendering of <math>0</math> (T288846)]] (duration: 01m 05s)

Mentioned in SAL (#wikimedia-operations) [2021-08-26T11:39:18Z] <lucaswerkmeister-wmde@deploy1002> Synchronized php-1.37.0-wmf.19/extensions/Math/src/HookHandlers/ParserHooksHandler.php: Backport: [[gerrit:714853|Allow rendering of <math>0</math> (T288846)]] (duration: 01m 04s)

I tested zeros on fr wiki and it seems to work again.