Last modified: 2014-05-13 17:16:15 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T65597, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 63597 - callParserFunction argument handling should match wikitext
callParserFunction argument handling should match wikitext
Status: RESOLVED FIXED
Product: MediaWiki extensions
Classification: Unclassified
Scribunto (Other open bugs)
unspecified
All All
: Normal major (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2014-04-06 20:11 UTC by orlodrim
Modified: 2014-05-13 17:16 UTC (History)
5 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description orlodrim 2014-04-06 20:11:21 UTC
The GeoData extension provides a parser function called "#coordinates". When the lua function callParserFunction is used in a module to call #coordinates with two integer arguments, a fatal exception occurs.

Steps to reproduce:

1. Create "Module:Sandbox" with this content:
local sandbox = {};
function sandbox.test(frame)
    frame:callParserFunction('#coordinates', {80, 30})
    return "abc"
end
return sandbox

2. Create a page with "{{#invoke:Sandbox|test}}" and save.

(example on frwiki: https://fr.wikipedia.org/w/index.php?title=Module:Sandbox&oldid=102691262, https://fr.wikipedia.org/wiki/Utilisateur:Orlodrim/callParserFunction)

I am not completely sure that it is a bug in Scribunto, rather than in GeoData, but note that the following code (with string arguments) does not cause an exception:

frame:callParserFunction('#coordinates', {'80', '30'})


Stack trace on my personal test wiki:

[a6b06752] /mediawiki-git/core/index.php?title=User:127.0.0.1&action=submit Exception from line 1205 of /home/orlodrim/mediawiki/core/includes/parser/Preprocessor_DOM.php: PPFrame_DOM::expand: Invalid parameter type

Backtrace:

#0 /home/orlodrim/mediawiki/extensions/GeoData/CoordinatesParserFunction.php(82): PPFrame_DOM->expand(integer)
#1 /home/orlodrim/mediawiki/extensions/GeoData/CoordinatesParserFunction.php(49): CoordinatesParserFunction->parseArgs(PPTemplateFrame_DOM, array)
#2 [internal function]: CoordinatesParserFunction->coordinates(Parser, PPTemplateFrame_DOM, array)
#3 /home/orlodrim/mediawiki/core/includes/parser/Parser.php(3616): call_user_func_array(array, array)
#4 /home/orlodrim/mediawiki/extensions/Scribunto/engines/LuaCommon/LuaCommon.php(502): Parser->callParserFunction(PPTemplateFrame_DOM, string, array)
#5 [internal function]: Scribunto_LuaEngine->callParserFunction(string, string, array)
#6 /home/orlodrim/mediawiki/extensions/Scribunto/engines/LuaStandalone/LuaStandaloneEngine.php(401): call_user_func_array(array, array)
#7 /home/orlodrim/mediawiki/extensions/Scribunto/engines/LuaStandalone/LuaStandaloneEngine.php(379): Scribunto_LuaStandaloneInterpreter->callback(string, array)
#8 /home/orlodrim/mediawiki/extensions/Scribunto/engines/LuaStandalone/LuaStandaloneEngine.php(426): Scribunto_LuaStandaloneInterpreter->handleCall(array)
#9 /home/orlodrim/mediawiki/extensions/Scribunto/engines/LuaStandalone/LuaStandaloneEngine.php(307): Scribunto_LuaStandaloneInterpreter->dispatch(array)
#10 /home/orlodrim/mediawiki/extensions/Scribunto/engines/LuaCommon/LuaCommon.php(195): Scribunto_LuaStandaloneInterpreter->callFunction(Scribunto_LuaStandaloneInterpreterFunction, Scribunto_LuaStandaloneInterpreterFunction)
#11 /home/orlodrim/mediawiki/extensions/Scribunto/engines/LuaCommon/LuaCommon.php(672): Scribunto_LuaEngine->executeFunctionChunk(Scribunto_LuaStandaloneInterpreterFunction, PPTemplateFrame_DOM)
#12 /home/orlodrim/mediawiki/extensions/Scribunto/common/Hooks.php(108): Scribunto_LuaModule->invoke(string, PPTemplateFrame_DOM)
#13 [internal function]: ScribuntoHooks::invokeHook(Parser, PPFrame_DOM, array)
#14 /home/orlodrim/mediawiki/core/includes/parser/Parser.php(3616): call_user_func_array(string, array)
#15 /home/orlodrim/mediawiki/core/includes/parser/Parser.php(3333): Parser->callParserFunction(PPFrame_DOM, string, array)
#16 /home/orlodrim/mediawiki/core/includes/parser/Preprocessor_DOM.php(1113): Parser->braceSubstitution(array, PPFrame_DOM)
#17 /home/orlodrim/mediawiki/core/includes/parser/Parser.php(3150): PPFrame_DOM->expand(PPNode_DOM, integer)
#18 /home/orlodrim/mediawiki/core/includes/parser/Parser.php(1212): Parser->replaceVariables(string)
#19 /home/orlodrim/mediawiki/core/includes/parser/Parser.php(395): Parser->internalParse(string)
#20 /home/orlodrim/mediawiki/core/includes/content/WikitextContent.php(306): Parser->parse(string, Title, ParserOptions, boolean, boolean, NULL)
#21 /home/orlodrim/mediawiki/core/includes/EditPage.php(3248): WikitextContent->getParserOutput(Title, NULL, ParserOptions)
#22 /home/orlodrim/mediawiki/core/includes/EditPage.php(2185): EditPage->getPreviewText()
#23 /home/orlodrim/mediawiki/core/includes/EditPage.php(441): EditPage->showEditForm()
#24 /home/orlodrim/mediawiki/core/includes/actions/EditAction.php(50): EditPage->edit()
#25 /home/orlodrim/mediawiki/core/includes/actions/EditAction.php(74): EditAction->show()
#26 /home/orlodrim/mediawiki/core/includes/Wiki.php(441): SubmitAction->show()
#27 /home/orlodrim/mediawiki/core/includes/Wiki.php(305): MediaWiki->performAction(Article, Title)
#28 /home/orlodrim/mediawiki/core/includes/Wiki.php(596): MediaWiki->performRequest()
#29 /home/orlodrim/mediawiki/core/includes/Wiki.php(460): MediaWiki->main()
#30 /home/orlodrim/mediawiki/core/index.php(49): MediaWiki->run()
#31 {main}
Comment 1 Gerrit Notification Bot 2014-04-07 16:24:49 UTC
Change 124346 had a related patch set uploaded by Anomie:
Stringify numbers in frame:callParserFunction

https://gerrit.wikimedia.org/r/124346
Comment 2 orlodrim 2014-04-07 17:35:13 UTC
Thanks Anomie for working on this bug!

I was just told by Zolo, who first ran into this problem, that a MediaWiki exception also occurs when #coordinates is called with no parameter at all (something that can never happen in wikicode, I think). Example:

frame:callParserFunction('#coordinates', {})

Is that something that you can address at the same time, or should I fill a separate bug report?
Comment 3 Brad Jorsch 2014-04-07 17:59:13 UTC
(In reply to orlodrim from comment #2)
> Is that something that you can address at the same time, or should I fill a
> separate bug report?

Let's retitle the bug so it covers both.
Comment 4 Gerrit Notification Bot 2014-05-13 05:17:49 UTC
Change 124346 merged by jenkins-bot:
Improve frame:callParserFunction argument validation

https://gerrit.wikimedia.org/r/124346
Comment 5 Brad Jorsch 2014-05-13 17:16:15 UTC
Change should be deployed to WMF wikis with 1.24wmf5, see https://www.mediawiki.org/wiki/MediaWiki_1.24/Roadmap for the schedule.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links