Last modified: 2014-09-20 19:07:58 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 T60929, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 58929 - Parameterless templates incorrectly cache dynamic functions
Parameterless templates incorrectly cache dynamic functions
Status: RESOLVED FIXED
Product: MediaWiki extensions
Classification: Unclassified
Other (Other open bugs)
unspecified
All All
: Normal normal (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-12-24 02:29 UTC by Robert Morley
Modified: 2014-09-20 19:07 UTC (History)
2 users (show)

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


Attachments

Description Robert Morley 2013-12-24 02:29:29 UTC
Parameterless templates seem to always be cached, regardless of the presence of dynamic functions within them.

As a simple example, install the DynamicFunctions extension from https://www.mediawiki.org/wiki/Extension:DynamicFunctions and create a new template, DieRoll, whose contents are simply {{#rand:1|6}}. Now, call {{DieRoll}} repeatedly from the same page. As added proof, add a dummy parameter and observe that the template is no longer cached (as noted on https://bugzilla.wikimedia.org/show_bug.cgi?id=30425) and that DieRoll is now random, as it should be.

If this can't be detected directly, I'd like to suggest adding a new magic work, like __DYNAMIC__ that will force the MediaWiki not to cache a template.

(Tested on 1.21.1, but I assume this hasn't changed recently.)
Comment 1 Jackmcbarn 2014-09-20 18:49:48 UTC
The core now supports this via PPFrame::setVolatile(). Any extensions that still exhibit the problem require a fix to the extension itself.
Comment 2 Jackmcbarn 2014-09-20 19:07:58 UTC
I've fixed the DynamicFunctions extension. See https://www.mediawiki.org/w/index.php?diff=1175414 for the fix. Note that unless you upgrade your wiki to 1.24, you'll need to cherry-pick https://gerrit.wikimedia.org/r/#/c/99792/ into your codebase for the fix to work.

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


Navigation
Links