Page MenuHomePhabricator

Built-in variables won't work in surrogate/phantom templates as of 1.35+
Open, Needs TriagePublic

Description

MediaWiki: 1.35.0
PHP: 7.4.12 (cgi-fcgi)
MySQL: 5.7.28-log
ICU: 57.1

The use of
%PAGE%, %TITLE%, %NAMESPACE% or any other built-in variable in surrogate/phantom templates in MediaWiki 1.35 results in that exact, plain-text being displayed in the output rather than the value of the built-in variable as it should, and as it did in 1.33, and 1.34, as it says in the documentation, and as it does in DPL3. So if the built-in variable %PAGE% value is "PageName" for example, in the output rather than "PageName" appearing, users see the plain-text output "%PAGE%", which breaks any functionality that relies on built-in DPL variables in surrogate/phantom templates (much of our site).

DPL statement calling surrogate (TemplateName.mysuffix):

{{#dpl:
|category=CategoryName
|count=5
|includepage={TemplateName}.mysuffix
|mode		    = userformat
|allowcachedresults = true
|listseparators    = \n{{{!}}class="wikitable sortable no-padding" \n{{!}}-\n! style="width:170px;" {{!}}Name \n!2nd Title \n! 3rd Title ,\n{{!}}-,\n{{!}}-\n{{!}}-,\n{{!}}}
|secseparators	    = \n{{!}},,\n{{!}},
|multisecseparators= ,\n{{!}}-\n{{!}}\n{{!}}
}}

Then, in the TemplateName.mysuffix surrogate template:

| %PAGE%
| [[File: %PAGE% icon.png|24px|link=%TITLE%]]
| Stuff for 3rd col

Expected result: Each row formatted by the surrogate should have the page name listed, followed by a its icon (which we upload as the matching [Page title]_icon.png, followed by any other data (as it works in DPL3, and has always worked prior to 1.35).

Unexpected outome: Each row in the surrogate instead displays the literal text - "%PAGE%" instead of the output of the built-in variable (which has always worked prior to 1.35 and documentation states should work, and works in DPL3 if we ignore the DB errors) | [Broken icon link for existing image matching its title exactly Page_title_icon.png] | rest of the data.

Added Issue: Interestingly, %TITLE% has also stopped working in tablerow parameter, where %PAGE% continues working in that parameter. I had to swap out all instances of %TITLE% for %PAGE% to restore them to working order in tablerow parameter values.

In summary, built-in variables appear to be broken for surrogate templates in MediaWiki 1.35, and some built-in varibales stop working in some parameter values randomly as well, such as %TITLE% but not %PAGE% in tablerow parameter values . We started with DPL3, then went to upgrade to 1.35 and learned it has been failing silently in the background with our 1.34 testing which became more visible in the logs once we started 1.35 testing (in the last 2 weeks, fortunately our production site is still on 1.33, though we are eager to get something working, either DPL2 or DPL3 in order to update our production site). We checked the DPL3 MW page and see it now flagged as incompatible in the last couple of weeks, then we tried to switch back to DPL2 as we have in the past, and discovered that in 1.35 built-in DPL variables are broken for our surrogate/phantom templates. Since surrogate/phantom templates allow for more complex reformatting and calculation of table cell information, and reuse, as well as being able to retrieve template parameter values from result sets, we use it for important parts of our site coupled with parser functions.

Given that 1.35 now has php parsoid, restbase and VE, a lot of smaller wikis are wanting to upgrade, especially with hosts asking us to keep our software up to date. I'm really hoping one of the two extensions can be made compatible with MW 1.35. Please let me know what/if other information is needed, and how best to go about providing it to be helpful in this, thanks!