Last modified: 2011-03-13 18:06:52 UTC

Wikimedia Bugzilla is closed!

Wikimedia has migrated from Bugzilla to Phabricator. Bug reports should be created and updated in Wikimedia Phabricator instead. Please create an account in Phabricator and add your Bugzilla email address to it.
Wikimedia Bugzilla is read-only. If you try to edit or create any bug report in Bugzilla you will be shown an intentional error message.
In order to access the Phabricator task corresponding to a Bugzilla report, just remove "static-" from its URL.
You could still run searches in Bugzilla or access your list of votes but bug reports will obviously not be up-to-date in Bugzilla.
Bug 8320 - Pass empty parameters to parser functions
Pass empty parameters to parser functions
Product: MediaWiki
Classification: Unclassified
Templates (Other open bugs)
PC Windows XP
: Lowest normal with 1 vote (vote)
: ---
Assigned To: Nobody - You can work on this!
Depends on:
  Show dependency treegraph
Reported: 2006-12-19 13:38 UTC by Fernando Correia
Modified: 2011-03-13 18:06 UTC (History)
0 users

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


Description Fernando Correia 2006-12-19 13:38:35 UTC
If a template includes a parser function passing parameters and some of these
parameters are empty, the parameter reference {{{n}}} is passed to the parser
function. An empty string should be passed.

For instance, the template includes:


The parser function declaration is:

function wfPlaySwfParserFunctionRender( &$parser, $filename = '', $filetitle =
'', $width='', $height='' )

If a template is used with only two parameters, $width and $heigth receive
"{{{3}}}" and "{{{4}}}" in the parser function. They should be empty.
Comment 1 Aryeh Gregor (not reading bugmail, please e-mail directly) 2006-12-19 23:38:52 UTC
Um, isn't this what parameter defaults are for?  {{{1|}}} will return empty if 1
is undefined.
Comment 2 Fernando Correia 2006-12-20 10:08:58 UTC
You may be right. But I think it's odd that an extension should receive such a
string. It seems like the template parameter syntax should be resolved within
the template, not exposed. 
Comment 3 Phil Boswell 2006-12-20 12:09:04 UTC
It's no more odd than specifying that a function should receive an object reference 
(eg &$parser) rather than a scalar value (eg $filename).

In both cases you have to make sure that you pass the correct kind of parameter 
otherwise your code is not going to work.

The point here is that the wiki-text "{{{3}}}" is defined to be the value of anonymous 
parameter #3 unless that parameter is blank in which case the default value 
is "{{{3}}}". Changing that definition would breaking existing usage and is unlikely 
to happen. Having your function validate its input would probably be your best bet.
Comment 4 Fernando Correia 2006-12-20 13:48:25 UTC
OK, thanks.

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