Page MenuHomePhabricator

[Regression] File pages named having a dollar sign + number redirect to main page
Closed, ResolvedPublic

Description

Since the update to 1.19 all files containing a dollar sign ($) seem to redirect to the main page. Try the URL or
https://commons.wikimedia.org/wiki/File:Billete_$100_Mexico_Centenario_Reverso.png?action=history (shows history of the main page)

If you need more examples, there are enough in https://commons.wikimedia.org/wiki/Category:1_United_States_dollar_banknotes.

But https://simple.wikipedia.org/wiki/$kip works correctly.


Version: 1.19
Severity: major
URL: http://simple.wikipedia.org/wiki/File:Billete_$100_Mexico_Centenario_Reverso.png

Details

Reference
bz34684

Event Timeline

bzimport raised the priority of this task from to High.Nov 22 2014, 12:13 AM
bzimport set Reference to bz34684.
bzimport added a subscriber: Unknown Object (MLST).

This was to do with the PathRouter code.

The PathRouter has an extra check to make sure all parameters have been replaced:
For example this:
$router->add( "/wiki/$1", array( 'title' => "$1$2" );
Should never succeed because $2 will never be replaced. It's also just in case there is a situation where it's not a coding error and that is in fact happening because the pattern is not a proper match.

The problem was that it couldn't tell the difference between a $# or $key in the pattern that wasn't replaced and a $1 that came from the url.

I've updated the tests to include some cases I didn't think of originally. And I've fixed the issue by switching to a preg_replace_callback based system.

I bisected it to r104274 which was reverted, then bisected it again to r104689.

reclosing, looks like it was fixed while I was having lunch :-)