From 8f74078b360fcc37ef06e220531d28c7d31cae8a Mon Sep 17 00:00:00 2001 From: Aryeh Gregor Date: Tue, 20 Nov 2007 19:00:55 +0000 Subject: [PATCH] * Fix Special:Userrights logs for users with special characters in their names. Previously it was urlencoding the page name passed to the FauxRequest, which did *not* urldecode it, so the constraint was being ignored by LogReader as invalid and the whole log was being posted. * Whitespace, __METHOD__, documentation for FauxRequest to avoid (hopefully?) a repeat bug * Todo: look for other instances of the bug --- RELEASE-NOTES | 2 ++ includes/SpecialLog.php | 3 ++- includes/SpecialUserrights.php | 2 +- includes/WebRequest.php | 5 +++++ 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 8e674d80aa..e537bdd617 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -179,6 +179,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * Do not present an image bigger than the source when 'frameless' option is used (to be consistent with the 'thumb' option now) * Support {{PLURAL}} for import log +* Make sure that the correct log entries are shown on Special:Userrights even + for users with special characters in their names == Parser changes in 1.12 == diff --git a/includes/SpecialLog.php b/includes/SpecialLog.php index 4ba0faf234..e9dbf81bff 100644 --- a/includes/SpecialLog.php +++ b/includes/SpecialLog.php @@ -123,6 +123,7 @@ class LogReader { */ function limitTitle( $page , $pattern ) { global $wgMiserMode; + $title = Title::newFromText( $page ); if( strlen( $page ) == 0 || !$title instanceof Title ) @@ -182,7 +183,7 @@ class LogReader { * @return ResultWrapper result object to return the relevant rows */ function getRows() { - $res = $this->db->query( $this->getQuery(), 'LogReader::getRows' ); + $res = $this->db->query( $this->getQuery(), __METHOD__ ); return $this->db->resultObject( $res ); } diff --git a/includes/SpecialUserrights.php b/includes/SpecialUserrights.php index 6af65c33b2..b9815fd4d4 100644 --- a/includes/SpecialUserrights.php +++ b/includes/SpecialUserrights.php @@ -390,7 +390,7 @@ class UserrightsForm extends HTMLForm { new FauxRequest( array( 'type' => 'rights', - 'page' => $user->getUserPage()->getPrefixedUrl(), + 'page' => $user->getUserPage()->getPrefixedText(), ) ) ) diff --git a/includes/WebRequest.php b/includes/WebRequest.php index aa9885f026..b549b9e66e 100644 --- a/includes/WebRequest.php +++ b/includes/WebRequest.php @@ -579,6 +579,11 @@ class FauxRequest extends WebRequest { var $data = null; var $wasPosted = false; + /** + * @param array $data Array of *non*-urlencoded key => value pairs, the + * fake GET/POST values + * @param bool $wasPosted Whether to treat the data as POST + */ function FauxRequest( $data, $wasPosted = false ) { if( is_array( $data ) ) { $this->data = $data; -- 2.20.1