r20756 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r20755‎ | r20756 | r20757 >
Date:21:43, 27 March 2007
Author:brion
Status:old
Tags:
Comment:
Revert r20426 which added an unused $isvalid parameter on Title::newFromURL()
It gives me the willies...
Modified paths:
  • /trunk/phase3/includes/Title.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Title.php
@@ -161,12 +161,11 @@
162162 * Create a new Title from URL-encoded text. Ensures that
163163 * the given title's length does not exceed the maximum.
164164 * @param string $url the title, as might be taken from a URL
165 - * @param bool $isvalid, allows for multiple colons and characters set as illegal
166165 * @return Title the new object, or NULL on an error
167166 * @static
168167 * @access public
169168 */
170 - public static function newFromURL( $url, $isvalid=true ) {
 169+ public static function newFromURL( $url ) {
171170 global $wgLegalTitleChars;
172171 $t = new Title();
173172
@@ -178,7 +177,7 @@
179178 }
180179
181180 $t->mDbkeyform = str_replace( ' ', '_', $url );
182 - if( $t->secureAndSplit( $isvalid ) ) {
 181+ if( $t->secureAndSplit() ) {
183182 return $t;
184183 } else {
185184 return NULL;
@@ -1706,11 +1705,10 @@
17071706 * removes illegal characters, splits off the interwiki and
17081707 * namespace prefixes, sets the other forms, and canonicalizes
17091708 * everything.
1710 - * @param bool $isvalid, allows for multiple colons and characters set as illegal
17111709 * @return bool true on success
17121710 * @private
17131711 */
1714 - /* private */ function secureAndSplit( $isvalid=true ) {
 1712+ /* private */ function secureAndSplit() {
17151713 global $wgContLang, $wgLocalInterwiki, $wgCapitalLinks;
17161714
17171715 # Initialisation
@@ -1811,7 +1809,7 @@
18121810 $this->mArticleID = 0;
18131811 }
18141812 $fragment = strstr( $dbkey, '#' );
1815 - if ( $isvalid && false !== $fragment ) {
 1813+ if ( false !== $fragment ) {
18161814 $this->setFragment( $fragment );
18171815 $dbkey = substr( $dbkey, 0, strlen( $dbkey ) - strlen( $fragment ) );
18181816 # remove whitespace again: prevents "Foo_bar_#"
@@ -1821,7 +1819,7 @@
18221820
18231821 # Reject illegal characters.
18241822 #
1825 - if( $isvalid && preg_match( $rxTc, $dbkey ) ) {
 1823+ if( preg_match( $rxTc, $dbkey ) ) {
18261824 return false;
18271825 }
18281826

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r20426*Add $isvalid arg to newFromURL() for proxy pages like User:#4 or y:y:yaaron01:15, 14 March 2007