Last modified: 2010-05-15 15:33:32 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 89 - when using subst: template parameters are not substituted
when using subst: template parameters are not substituted
Product: MediaWiki
Classification: Unclassified
Templates (Other open bugs)
All All
: Normal normal with 1 vote (vote)
: ---
Assigned To: Nobody - You can work on this!
: parser
: 104 155 (view as bug list)
Depends on:
  Show dependency treegraph
Reported: 2004-08-16 06:00 UTC by Timwi
Modified: 2010-05-15 15:33 UTC (History)
4 users (show)

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

Proposed patch for parameterized template substitution (2.54 KB, patch)
2004-09-02 16:30 UTC, Alan

Description Timwi 2004-08-16 06:00:22 UTC
Originally submitted by Nobody/Anonymous - nobody  2004-06-06 10:31

When using {{subst:}} with a parameterized template,
the parameters are not substituted. The template is
simply brought in as-is.

For an example, see

-- [[en:User:Cyrius]]
Comment 1 Rowan Collins [IMSoP] 2004-08-16 23:28:31 UTC
*** Bug 104 has been marked as a duplicate of this bug. ***
Comment 2 Timwi 2004-08-19 10:01:52 UTC
*** Bug 155 has been marked as a duplicate of this bug. ***
Comment 3 Alan 2004-09-02 16:30:36 UTC
Created attachment 22 [details]
Proposed patch for parameterized template substitution

I've developed a patch to enable substituted templates to make use of
parameters at the time of substitution.  I've done some quick tests of the
patched code on a local test installation of MediaWiki from the latest CVS
sources and things seem to work fine, but I don't know enough to do adequate
regression testing.  I have limited the effect of my changes to template
substitution performed when mOutputType == OT_WIKI, so if there's any reason to
include other output types (such as OT_MSG) then the code will have to	be
adjusted accordingly.

This is my first-ever contribution to MediaWiki code and I'm not a PHP guru, so
please scrutinize my code carefully because there's a good chance that I
haven't a clue what I'm doing. :)
Comment 4 Wil Mahan 2004-09-08 19:06:49 UTC
Alan, thanks for looking at the code and submitting a patch. I am also
inexperienced in MediaWiki development, so I'm not an expert on this area
either. But I think you have the right idea for how to implement this change.

I noticed a problem, however; if I understand your patch correctly, it causes
variables to be substituted during the preSaveTransform phase, whereas before
your patch only {{subst:}} type templates were substituted.

For example, if I create a page using the current CVS code with the magic
variable {{CURRENTTIME}}, it is saved to the database without substitution, so
every time I view the page it displays the current time. But with your patch
applied, if I create the same page, the parser substitutes the current time when
I save the page. Thus the page will always display the fixed time at which I
saved the page, rather than dynamically updating as intended.

I don't think it will be difficult to address this issue. Thanks again for the
Comment 5 Wil Mahan 2004-09-22 00:20:11 UTC
Fixed in HEAD (Parser.php revision 1.294). Thanks to Alan for the patch, which I
modified to address the problem I mentioned and to work with other recent Parser
Comment 6 Brion Vibber 2004-12-11 21:32:03 UTC
Resolving as fixed with 1.4 release imminent.

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