Page MenuHomePhabricator

Wrong #var and #varexists values due to template caching
Closed, ResolvedPublicBUG REPORT

Description

If you use a template using Variables with the same parameters twice in a row, it isn't considered if the Variables have changed between these two calls. This happens due to template caching and should be fixable by marking the #var and #varexists function as volatile.

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptApr 5 2018, 10:22 PM

To maintain backwards compatibility, it should be possible to turn off the new behavior, although it should be expected.

MGChecker triaged this task as High priority.Apr 5 2018, 10:33 PM

Change 424583 had a related patch set uploaded (by MGChecker; owner: MGChecker):
[mediawiki/extensions/Variables@master] [WiP] Prevent issued due to template caching

https://gerrit.wikimedia.org/r/424583

MGChecker renamed this task from Wrong #var values due to template caching to Wrong #var and #varexists values due to template caching.Apr 21 2018, 7:14 PM
MGChecker updated the task description. (Show Details)

Change 424583 merged by jenkins-bot:
[mediawiki/extensions/Variables@master] Prevent issues due to template caching

https://gerrit.wikimedia.org/r/424583

MGChecker closed this task as Resolved.Apr 25 2018, 3:38 PM

@MGChecker Thanks a lot for working on this. Since this is only in master woudn't it be nice to backport to REL1_31 which is LTS?

Change 428946 had a related patch set uploaded (by Kghbln; owner: MGChecker):
[mediawiki/extensions/Variables@REL1_31] Prevent issues due to template caching

https://gerrit.wikimedia.org/r/428946

Change 428946 merged by jenkins-bot:
[mediawiki/extensions/Variables@REL1_31] Prevent issues due to template caching - backport from master

https://gerrit.wikimedia.org/r/428946

I think I've always decided against implementing this as I've learned to consider this a feature rather than a bug. If you don't want the template to be cached you can simply do {{template|}}

I think this is the straightforward way you would expect Variables to work, according to multiple bug reports received in the task on MediaWiki.org, Phabricator, and other channels- That's why I implemented this, as it's really easy to do since MW 1.24 has been released.

Furthermore, the old behavior wasn't really consistent, as Variables behaved differently if the PPFrame became volatile because of some other reason, for example Cite or another extension.

Danwe added a comment.Sep 23 2018, 9:56 AM

Just consider that this is a breaking change, so version number should ideally be bumped to v3.0

This code has already been released as Variables v2.4, however it's possible to switch back to the old behavior setting PHP configuration globals. I don't intend to remove this configuration setting before bumping Variables version to v3.0.

MGChecker changed the subtype of this task from "Task" to "Bug Report".Mar 1 2019, 11:36 PM