Improve/rename Parser::replaceUnusualEscapes
authorBrad Jorsch <bjorsch@wikimedia.org>
Sat, 21 Dec 2013 02:14:48 +0000 (21:14 -0500)
committerTim Starling <tstarling@wikimedia.org>
Tue, 16 Sep 2014 23:00:16 +0000 (23:00 +0000)
commite2c9d4dfa90b57cad70ad185e6667e8ba76464db
tree2147c208a83ef3801e764229380798c62d64afcc
parent556b75985dc9670b7d1224c317f121904f658856
Improve/rename Parser::replaceUnusualEscapes

The previous implementation would unescape '&', '=', '+', and '%'. The
first three will break the URL when unescaped in the query string, and
the last will break when unescaped anywhere.

The code is now changed to treat the path, query, and fragment parts of
the URL separately when unescaping. We also escape any unsafe characters
and ensure all percent-encodings use uppercase hexits.

And since the old name is no longer accurate,
Parser::replaceUnusualEscapes is deprecated in favor of
Parser::normalizeLinkUrl.

Bug: 57909
Change-Id: I77dc308d0d016c395ad737c08cf10a7711e25bbd
RELEASE-NOTES-1.24
includes/parser/Parser.php
tests/phpunit/includes/parser/ParserMethodsTest.php