http://www.mediawiki.org/wiki/Special:Code/MediaWiki/97857
Revision: 97857
Author: brion
Date: 2011-09-22 21:35:24 +0000 (Thu, 22 Sep 2011)
Log Message:
-----------
* (bug 31100) Fix regression in sidebar (special: page links lost parameters)
Regression in Title::fixSpecialName() in r86255; fixed and added a unit test
case to TitleTest.
Modified Paths:
--------------
trunk/phase3/includes/Title.php
trunk/phase3/tests/phpunit/includes/TitleTest.php
Modified: trunk/phase3/includes/Title.php
===================================================================
--- trunk/phase3/includes/Title.php 2011-09-22 21:30:14 UTC (rev 97856)
+++ trunk/phase3/includes/Title.php 2011-09-22 21:35:24 UTC (rev 97857)
@@ -4194,9 +4194,9 @@
*/
public function fixSpecialName() {
if ( $this->getNamespace() == NS_SPECIAL ) {
- list( $canonicalName, /*...*/ ) =
SpecialPageFactory::resolveAlias( $this->mDbkeyform );
+ list( $canonicalName, $par ) =
SpecialPageFactory::resolveAlias( $this->mDbkeyform );
if ( $canonicalName ) {
- $localName =
SpecialPageFactory::getLocalNameFor( $canonicalName );
+ $localName =
SpecialPageFactory::getLocalNameFor( $canonicalName, $par );
if ( $localName != $this->mDbkeyform ) {
return Title::makeTitle( NS_SPECIAL,
$localName );
}
Modified: trunk/phase3/tests/phpunit/includes/TitleTest.php
===================================================================
--- trunk/phase3/tests/phpunit/includes/TitleTest.php 2011-09-22 21:30:14 UTC
(rev 97856)
+++ trunk/phase3/tests/phpunit/includes/TitleTest.php 2011-09-22 21:35:24 UTC
(rev 97857)
@@ -15,4 +15,26 @@
}
}
+ /**
+ * @dataProvider dataBug31100
+ */
+ function testBug31100FixSpecialName( $text, $expectedParam ) {
+ $title = Title::newFromText( $text );
+ $fixed = $title->fixSpecialName();
+ $stuff = explode( '/', $fixed->getDbKey(), 2 );
+ if ( count( $stuff ) == 2 ) {
+ $par = $stuff[1];
+ } else {
+ $par = null;
+ }
+ $this->assertEquals( $expectedParam, $par, "Bug 31100
regression check: Title->fixSpecialName() should preserve parameter" );
+ }
+
+ function dataBug31100() {
+ return array(
+ array( 'Special:Version', null ),
+ array( 'Special:Version/', '' ),
+ array( 'Special:Version/param', 'param' ),
+ );
+ }
}
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs