Last modified: 2011-03-13 18:06:52 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 T10320, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 8320 - Pass empty parameters to parser functions
Pass empty parameters to parser functions
Status: RESOLVED WONTFIX
Product: MediaWiki
Classification: Unclassified
Templates (Other open bugs)
1.8.x
PC Windows XP
: Lowest normal with 1 vote (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  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: ---


Attachments

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:

{{#swf:{{{1}}}|{{{2}}}|{{{3}}}|{{{4}}}}}

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.


Navigation
Links