r88172 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r88171‎ | r88172 | r88173 >
Date:13:06, 15 May 2011
Author:wikinaut
Status:resolved (Comments)
Tags:
Comment:
also treating localised Special:OpenIDXRDS pagename
Modified paths:
  • /trunk/extensions/OpenID/SpecialOpenIDServer.body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/OpenID/SpecialOpenIDServer.body.php
@@ -735,7 +735,9 @@
736736 $pattern = str_replace( '?', '\?', $pattern );
737737
738738 /* remove "Special:OpenIDXRDS/" to allow construction of a valid user page name */
739 - $relative = preg_replace("!Special:OpenIDXRDS/!", "", $relative);
 739+ $specialPagePrefix = SpecialPage::getTitleFor('OpenIDXRDS');
 740+ if ( $specialPagePrefix != "Special:OpenIDXRDS" ) $specialPagePrefix = "({$specialPagePrefix}|Special:OpenIDXRDS)";
 741+ $relative = preg_replace("!" . $specialPagePrefix . "/!", "", $relative);
740742
741743 # Can't have a pound-sign in the relative, since that's for fragments
742744 if ( !preg_match( "#$pattern#", $relative, $matches ) ) {

Follow-up revisions

RevisionCommit summaryAuthorDate
r95833added preg_quote() in the the OpenID server module as suggested in code revie...wikinaut04:49, 31 August 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r88141bug fixes 18635,27581,27419; new README.OpenID-mediawiki-extension to be dist...wikinaut10:22, 15 May 2011

Comments

#Comment by Nikerabbit (talk | contribs)   09:35, 16 May 2011

Anything external that is used in part of regex should be escaped with preg_quote( $str, '!' ); in this case. I still wonder if this is the best way to do it. Can't you for example construct a title object and use ->getSubPage()?

#Comment by Wikinaut (talk | contribs)   10:15, 16 May 2011

You are fully right. The whole code of (especially the) function UrlToUserName needs to be examined; I will do this with high priority, duly considering your concerns, advices and tips.

#Comment by Wikinaut (talk | contribs)   04:49, 31 August 2011

fixed in r95833

#Comment by Wikinaut (talk | contribs)   04:50, 31 August 2011

fixed in r95833

Status & tagging log