Page MenuHomePhabricator

Special page redirect to localized name corrupts spaces in query parameters, breaking color highlighting in RecentChanges for change tags with spaces in them
Open, Needs TriagePublic

Description

I assembled some filters at German Wikipedia, in order to check the usage of Growth features. I see the following:

Capture d’écran_2021-09-06_16-18-52.png (1×1 px, 756 KB)

URL:

https://de.wikipedia.org/wiki/Spezial:Letzte_Änderungen?hidebots=1&hidenewpages=1&hidecategorization=1&hideWikibase=1&tagfilter=mentorship module question|newcomer task&limit=500&days=30&enhanced=1&tagfilter__mentorship module question_color=c3&tagfilter__newcomer task_color=c1&urlversion=2

Then I wanted to check on the same thing at another wiki. I did the following:

  1. copy the link at de.wp
  2. open a new tab in my browser
  3. paste the link
  4. changed the wiki's language prefix
  5. replaced Spezial:Letzte_Änderungen with the generic Special:RecentChanges
  6. pressed Enter

Expectation:

  • same colors being applied

Reality:

  • no colors

Capture d’écran_2021-09-06_16-26-53.png (1×1 px, 530 KB)

URL reused and customized:

https://nl.wikipedia.org/w/index.php?title=Speciaal:RecenteWijzigingen&hidebots=1&hidenewpages=1&hidecategorization=1&hideWikibase=1&tagfilter=mentorship module question|newcomer task&limit=500&days=30&enhanced=1&tagfilter__mentorship_module_question_color=c3&tagfilter__newcomer_task_color=c1&urlversion=2

Tested one again at Spanish Wikipedia, with the same outcome. URL :

https://es.wikipedia.org/w/index.php?hidebots=1&hidenewpages=1&hidecategorization=1&hideWikibase=1&tagfilter=newcomer task&limit=500&days=30&enhanced=1&title=Especial:CambiosRecientes&tagfilter__mentorship_module_question_color=c3&tagfilter__newcomer_task_color=c1&urlversion=2

Strangly, the order if the elements in the page have been changed when the page loaded. See the position of Especial:CambiosRecientes.

I tried it at German one again, just copy/pasting the URL in a private browsing window, and still have no color. URL I got:

https://de.wikipedia.org/wiki/Spezial:Letzte_Änderungen?hidebots=1&hidenewpages=1&hidecategorization=1&hideWikibase=1&tagfilter=newcomer task|mentorship module question&limit=500&days=30&enhanced=1&tagfilter__newcomer task_color=c1&tagfilter__mentorship module question_color=c3&urlversion=2

I noticed that the URL was transformed when the page finishes to load.


I note that tagfilter__mentorship module question_color=c3 on the original URL is sometimes changed to tagfilter__mentorship_module_question_color=c3 (pluses instead of underscores)

Event Timeline

mewoph subscribed.

It looks like the colors don't work when going from generic Special:RecentChanges to the localized form.

The highlights show up when changing nl to de and Speciaal:RecenteWijzigingen to Spezial:Letzte_Änderungen in the following URL.

https://nl.wikipedia.org/w/index.php?tagfilter=mentorship module question|newcomer task add link&limit=500&days=30&enhanced=1&tagfilter__newcomer task add link_color=c1&title=Speciaal:RecenteWijzigingen&tagfilter__mentorship_module_question_color=c3&tagfilter__newcomer_task_add_link_color=c1&tagfilter__newcomer_task_color=c1&urlversion=2

Moving to Needs Discussion for prioritization

Tgr subscribed.

When you enter the English name on a non-English wiki, the browser gets redirected to the local name. Apparently that messes up the query parameters somewhat:

hidebots=1&hidenewpages=1&hidecategorization=1&hideWikibase=1&tagfilter=newcomer task&limit=500&days=30&enhanced=1&tagfilter__newcomer task_color=c1&tagfilter__mentorship module question_color=c3&urlversion=2
hidebots=1&hidenewpages=1&hidecategorization=1&hideWikibase=1&tagfilter=newcomer task&limit=500&days=30&enhanced=1&tagfilter__newcomer_task_color=c1&tagfilter__mentorship_module_question_color=c3&urlversion=2

(pre and post redirect, note the vs. _ as Benoît said). That's what we get for using spaces in change tag names, I suppose.

Could happen in WebRequest::getQueryValues() (called from SpecialPageFactory::executePath()), or somewhere in our infrastructure (Apache rewrite rules on the appserver hosts?) where we translate nice URLs to index.php ones.

Tgr renamed this task from Color highlighting in RecentChanges aren't displayed when you copy-paste the URL in a new wondow to Special page redirect to localized name corrupts spaces in query parameters, breaking color highlighting in RecentChanges for change tags with spaces in them.Sep 8 2021, 3:13 AM

@mewoph @Tgr -- is this bug limited only to the use case in which a user copy/pastes a RecentChanges URL from one language to another? If so, then this seems like an edge case that we would not be able to prioritize now.

Depending on where the error is, it might things other than recent changes, but for recent changes specifically, I think it would only affect that case.

It's actually PHP doing this. https://www.php.net/variables.external

Note:

Dots and spaces in variable names are converted to underscores. For example <input name="a.b" /> becomes $_REQUEST["a_b"].

Yeah that makes sense, SpecialPageFactory fetches query params via Request::getQueryValues() (which is basically just $_GET) for generating the redirect URL.

Maybe we should have a getActualQueryValues() which just parses the URL.