Last modified: 2013-03-26 15:25:18 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 T48566, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 46566 - getAllExpandedArguments needs to be order preserving
getAllExpandedArguments needs to be order preserving
Status: RESOLVED INVALID
Product: MediaWiki extensions
Classification: Unclassified
Scribunto (Other open bugs)
unspecified
All All
: Unprioritized normal (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-03-26 14:28 UTC by Robert Rohde
Modified: 2013-03-26 15:25 UTC (History)
3 users (show)

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


Attachments

Description Robert Rohde 2013-03-26 14:28:18 UTC
getAllExpandedArguments, which is called when one uses pairs( frame.args ), does not process the arguments in order.  Under at least one circumstance this breaks existing behavior.

Consider:

{{my_template
| top = <ref>Some Ref</ref>
| bottom = <references />
}}

In order for this to process correctly, it is required that the argument for top= be parsed before the argument for bottom=.  If they are parsed out of order, then the references tag will render as empty because no refs have yet been loaded.

In the current parser, in order processing is reliably performed, but it appears that Lua getAllExpandedArguments can process these arguments in either order.  The order used appears to be stable but unpredictable, so that for a given template it will consistently either behave correctly or incorrectly but similarly constructed templates can work differently.

Simply running a for loop over pairs( frame.args ) and exporting the keys will show that the ordering of the keys bears no apparent relationship to the ordering of the input.

A consequence of this bug is discussed at:
http://en.wikipedia.org/wiki/Template_talk:Navbox#Bugs
Comment 1 Brad Jorsch 2013-03-26 15:25:18 UTC
getAllExpandedArguments does process arguments in order.

The linked discussion complains that the following parses list1 before below:

  {{Navbox with columns
  |navbar = plain
  |state = plain
  |title = Navbox with columns
  |list1 = Item<ref group="b">aaa</ref>
  |below = Reflist: {{reflist|group="b"}}
  }}

This is expected, considering that [[Template:Navbox with columns]] simply calls [[Template:Navbox]] and passes {{{below|}}} to that template before {{{list1}}}. Template:Navbox is the one that has the #invoke, so its argument order is the order that is used by getAllExpandedArguments in pairs( frame:getParent().args ).

The reason this sort of thing worked with the old parserfunction-based templates is that the old version of Template:Navbox itself processed its arguments in the expected order rather than in whatever order they were passed to the template.

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


Navigation
Links