Page MenuHomePhabricator

An exception is thrown if an argument value passed to frame:expandTemplate has an invalid type
Closed, ResolvedPublic


I can't read or its history versions, I've tried with Firefox in Monobook and Chrome in Vector.

Event Timeline

JackPotte raised the priority of this task from to Unbreak Now!.
JackPotte updated the task description. (Show Details)
JackPotte changed Security from none to None.
JackPotte added a subscriber: JackPotte.

PS: the history before the renaming is readable.

Thanks for reporting this. worked for me, and afterwards also works for me. Does this still happen to you? Are there other pages affected?
In general, pasting the exact full error output is welcome.

JackPotte claimed this task.

It's repaired now, sorry but I didn't write the long alphanumeric code when it was failing, but I had noticed that it was different according to the versions.

Sorry but it's back again, herewith the error:
[0559a619] 2014-12-03 13:35:07: Fatal exception of type MWException

We need someone to look up the stacktrace for [0559a619] on fr.wikibooks. CC'ing hoo and Reedy

Aklapper lowered the priority of this task from Unbreak Now! to High.Dec 3 2014, 3:07 PM

It's affecting at least another page, and some people are reverting the last versions of our books because of that:

We need someone to look up the stacktrace for [0559a619] on fr.wikibooks. CC'ing hoo and Reedy

12014-12-03 13:35:07 mw1248 frwikibooks: [0559a619] /wiki/Chimie_organique/Ethers
2 MWException from line 1952 of /srv/mediawiki/php-1.25wmf10/includes/parser/Preprocessor_Hash.php: PPNode_Hash_Text given object instead of string
3#0 /srv/mediawiki/php-1.25wmf10/includes/parser/Preprocessor_Hash.php(81): PPNode_Hash_Text->__construct()
4#1 /srv/mediawiki/php-1.25wmf10/extensions/Scribunto/engines/LuaCommon/LuaCommon.php(637): Preprocessor_Hash->newPartNodeArray()
5#2 /srv/mediawiki/php-1.25wmf10/extensions/Scribunto/engines/LuaSandbox/Engine.php(366): Scribunto_LuaEngine->expandTemplate()
6#3 (): Scribunto_LuaSandboxCallback->__call()
7#4 /srv/mediawiki/php-1.25wmf10/extensions/Scribunto/engines/LuaSandbox/Engine.php(279): LuaSandboxFunction->call()
8#5 /srv/mediawiki/php-1.25wmf10/extensions/Scribunto/engines/LuaCommon/LuaCommon.php(254): Scribunto_LuaSandboxInterpreter->callFunction()
9#6 /srv/mediawiki/php-1.25wmf10/extensions/Scribunto/engines/LuaCommon/LuaCommon.php(867): Scribunto_LuaEngine->executeFunctionChunk()
10#7 /srv/mediawiki/php-1.25wmf10/extensions/Scribunto/common/Hooks.php(113): Scribunto_LuaModule->invoke()
11#8 /srv/mediawiki/php-1.25wmf10/includes/parser/Parser.php(3846): ScribuntoHooks::invokeHook()
12#9 /srv/mediawiki/php-1.25wmf10/includes/parser/Parser.php(3568): Parser->callParserFunction()
13#10 /srv/mediawiki/php-1.25wmf10/includes/parser/Preprocessor_Hash.php(1108): Parser->braceSubstitution()
14#11 /srv/mediawiki/php-1.25wmf10/includes/parser/Parser.php(3716): PPFrame_Hash->expand()
15#12 /srv/mediawiki/php-1.25wmf10/includes/parser/Preprocessor_Hash.php(1108): Parser->braceSubstitution()
16#13 /srv/mediawiki/php-1.25wmf10/extensions/Scribunto/engines/LuaCommon/LuaCommon.php(794): PPFrame_Hash->expand()
17#14 /srv/mediawiki/php-1.25wmf10/extensions/Scribunto/engines/LuaCommon/LuaCommon.php(643): Scribunto_LuaEngine->doCachedExpansion()
18#15 /srv/mediawiki/php-1.25wmf10/extensions/Scribunto/engines/LuaSandbox/Engine.php(366): Scribunto_LuaEngine->expandTemplate()
19#16 (): Scribunto_LuaSandboxCallback->__call()
20#17 /srv/mediawiki/php-1.25wmf10/extensions/Scribunto/engines/LuaSandbox/Engine.php(279): LuaSandboxFunction->call()
21#18 /srv/mediawiki/php-1.25wmf10/extensions/Scribunto/engines/LuaCommon/LuaCommon.php(254): Scribunto_LuaSandboxInterpreter->callFunction()
22#19 /srv/mediawiki/php-1.25wmf10/extensions/Scribunto/engines/LuaCommon/LuaCommon.php(867): Scribunto_LuaEngine->executeFunctionChunk()
23#20 /srv/mediawiki/php-1.25wmf10/extensions/Scribunto/common/Hooks.php(113): Scribunto_LuaModule->invoke()
24#21 /srv/mediawiki/php-1.25wmf10/includes/parser/Parser.php(3846): ScribuntoHooks::invokeHook()
25#22 /srv/mediawiki/php-1.25wmf10/includes/parser/Parser.php(3568): Parser->callParserFunction()
26#23 /srv/mediawiki/php-1.25wmf10/includes/parser/Preprocessor_Hash.php(1108): Parser->braceSubstitution()
27#24 /srv/mediawiki/php-1.25wmf10/includes/parser/Preprocessor_Hash.php(1545): PPFrame_Hash->expand()
28#25 /srv/mediawiki/php-1.25wmf10/includes/parser/Parser.php(3713): PPTemplateFrame_Hash->cachedExpand()
29#26 /srv/mediawiki/php-1.25wmf10/includes/parser/Preprocessor_Hash.php(1108): Parser->braceSubstitution()
30#27 /srv/mediawiki/php-1.25wmf10/includes/parser/Parser.php(3378): PPFrame_Hash->expand()
31#28 /srv/mediawiki/php-1.25wmf10/includes/parser/Parser.php(1245): Parser->replaceVariables()
32#29 /srv/mediawiki/php-1.25wmf10/includes/parser/Parser.php(435): Parser->internalParse()
33#30 /srv/mediawiki/php-1.25wmf10/includes/content/WikitextContent.php(338): Parser->parse()
34#31 /srv/mediawiki/php-1.25wmf10/includes/content/AbstractContent.php(490): WikitextContent->fillParserOutput()
35#32 /srv/mediawiki/php-1.25wmf10/includes/poolcounter/PoolWorkArticleView.php(140): AbstractContent->getParserOutput()
36#33 /srv/mediawiki/php-1.25wmf10/includes/poolcounter/PoolCounterWork.php(123): PoolWorkArticleView->doWork()
37#34 /srv/mediawiki/php-1.25wmf10/includes/page/Article.php(688): PoolCounterWork->execute()
38#35 /srv/mediawiki/php-1.25wmf10/includes/actions/ViewAction.php(44): Article->view()
39#36 /srv/mediawiki/php-1.25wmf10/includes/MediaWiki.php(414): ViewAction->show()
40#37 /srv/mediawiki/php-1.25wmf10/includes/MediaWiki.php(282): MediaWiki->performAction()
41#38 /srv/mediawiki/php-1.25wmf10/includes/MediaWiki.php(584): MediaWiki->performRequest()
42#39 /srv/mediawiki/php-1.25wmf10/includes/MediaWiki.php(435): MediaWiki->main()
43#40 /srv/mediawiki/php-1.25wmf10/index.php(46): MediaWiki->run()
44#41 /srv/mediawiki/w/index.php(3): include()
45#42 {main}

Thanks! Stacktrace mentions both Parser/Preprocessor and Scribunto/Lua - CC'ing anomie and crossing fingers that I haven't made the wrong guess.

Jackmcbarn renamed this task from Fatal exception of type MWException in fr.wikibooks to An exception is thrown if an argument value passed to frame:expandTemplate has an invalid type.Dec 4 2014, 2:27 AM
Jackmcbarn lowered the priority of this task from High to Medium.
Jackmcbarn added a subscriber: Jackmcbarn.

This happens when you pass something like a function or table as an argument value, like this:
=mw.getCurrentFrame():expandTemplate{title = 'Echo', args = {function() end}}

Also of note is that it only happens with Preprocessor_Hash, not with _DOM.

Anomie added a project: MediaWiki-Core-Team.
Anomie moved this task from Backlog to Needs Review/Feedback on the MediaWiki-Core-Team board.

The argument validation needs to be there, but the fact that the code on frwikibooks is passing invalid argument types needs fixing on frwikibooks.

Change 177564 had a related patch set uploaded (by Anomie):
Improve argument validation in frame:expandTemplate()


OK, so I'll remove from the dozen of books where it was, because it was working before based on the summary array displaying...

Don't remove the module. Just fix the bug in it.

Too late for that.

If nobody wants to assure a backward compatibility or an exception handling, you can close this ticket.

No, it's not too late for that. Whatever changes were made can be reverted. We are fixing the problem on our end, as you can see above.

If nobody wants to assure a backward compatibility or an exception handling, you can close this ticket.

There's no "backwards compatibility" to maintain here, it was always broken. The difference is that Preprocessor_DOM silently ignored the invalid types (using empty-string instead) while Preprocessor_Hash throws an exception.

And the reason for Preprocessor_Hash is because HHVM has/had issues with libxml (Gerrit change 155594).

As for "exception handling", Gerrit change 177564 is preventing the invalid types from being passed through in the first place.

I was just noticing that before the last migration the books pages displayed their contents, and not at all after (the only reason why I had initially put this task in priority "unbreak now"). This outage (complete service cut for a dozen of books) took place a few hours until I removed the Lua from them.

Change 177564 merged by jenkins-bot:
Improve argument validation in frame:expandTemplate()

The fix for this will be live on Wikibooks on December 16th. In the meantime, the module that was causing this bug should be fixed (since it's broken itself) and reinstated.