Last modified: 2011-06-08 20:34:10 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 T31319, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 29319 - [VariablesExtension] Transcluded pages fetch variables only for the first transclusion
[VariablesExtension] Transcluded pages fetch variables only for the first tra...
Status: NEW
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: 2011-06-08 15:08 UTC by LWChris
Modified: 2011-06-08 20:34 UTC (History)
0 users

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


Attachments

Description LWChris 2011-06-08 15:08:52 UTC
Occurred on MediaWiki 1.16.5

Used in this test: Page A, Template B and Template C

Page A:
a:{{#vardefineecho:v|2}}
b:{{B}}
b:{{B}}
a:{{#vardefineecho:v|{{#expr:{{#var:v}}+4}}}}
c:{{C}}
b:{{B}}

Template B:
{{#vardefineecho:v|{{#expr:{{#var:v}}+1}}}}

Template C:
{{#vardefineecho:v|{{#expr:{{#var:v}}+2}}}}

Expected output: a:2 b:3 b:4 a:8 c:10 b:11

Actual output: a:2 b:3 b:3 a:7 c:9 b:3

It's obvious the variable values are only retrieved once for the first transclusion of a template. Changes to the variables are visible for the transcluding page (see a:7), but not on the second, third, ... transclusion of any template.
Comment 1 LWChris 2011-06-08 18:42:10 UTC
Complete version details:

MediaWiki 1.16.5
PHP 5.3.5
MySQL 5.5.8
ParserFunctions 1.3.0
Variables 1.3.1

No other parser hooks installed.

I created Template D
{{#vardefineecho:v|{{#expr:{{#var:v}}+3}}}}

and added d:{{D}} on Page A. Now I get a:2 b:3 b:3 a:7 c:9 b:3 d:12. Thus I think the problem is the transcluded pages are cached and therefore the parsing is only done once for all transclusions which would also explain why the changes are visible after the first transclusion but not applied twice or thrice.

Maybe a related variable is $wgTranscludeCacheExpiry?
Comment 2 LWChris 2011-06-08 20:34:10 UTC
Okay meanwhile I'm sure that it's a caching issue. Following setup:

Template B:
{{#var:v}}

Page A:
{{#vardefine:v|1}}{{B}}
{{#vardefine:v|2}}{{B}}
Output: 1 1

An easy workaround is to add a pseudo unnamed parameter:

Page A:
{{#vardefine:v|1}}{{B|}}
{{#vardefine:v|2}}{{B|}}
Output: 1 2

Maybe there's some possibility to automatically disable caching if the page contains a variable parser hook.

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


Navigation
Links