Page MenuHomePhabricator

Magic words broken after redirect in template called by wfMessage
Open, LowPublicBUG REPORT

Description

In a skin or on Category page I use wfMessage to call a template to add content.

In the template I use {{PAGENAME}}.

If the page is redirected, {{PAGENAME}} returns the wrong redirecting title.

This worked in MW 1.16 and is now broken in MW 1.22.


Version: 1.22.12
Severity: normal

Details

Reference
bz72230

Event Timeline

bzimport raised the priority of this task from to Needs Triage.Nov 22 2014, 3:48 AM
bzimport set Reference to bz72230.
bzimport added a subscriber: Unknown Object (MLST).

Also wgIsRedirect is false on the landing page. Should be true imo since I was redirected.

I'm using javascript to redirect now to fix this bug.

This cannot be right!

Can you give us some example code that demonstrates the issue (Or concrete steps to reproduce)?

What title wfMessage() considers the current page to be can vary depending on at what time in execution it is called (Evil hidden global magic), so it helps to know at what point the function is being called. (Also, if you have an instance of IContextSource handy, calling the ->msg() method is more likely to get the right title, than a generic call to wfMessage, although ideally either would work).

CategoryViewer.php > function getCategoryTop() > somewhere add

$r .= wfMessage( 'myMessage', 'fooBar' )->parse();

MediaWiki:MyMessage > add

{{MyMessageTemplate}}

Template:MyMessageTemplate > add

{{PAGENAME}}

Create a redirect category. Call the redirecting category > After the redirect the head reads the wrong page name.

Same result for $r .= $this->msg( 'myMessage', 'fooBar' )->parse();

I can pass the title in the message but that would be so 1999.

Aklapper triaged this task as Low priority.Feb 4 2022, 8:07 PM
Aklapper changed the subtype of this task from "Task" to "Bug Report".