Index: trunk/phase3/tests/phpunit/includes/TitleTest.php |
— | — | @@ -15,4 +15,26 @@ |
16 | 16 | } |
17 | 17 | } |
18 | 18 | |
| 19 | + /** |
| 20 | + * @dataProvider dataBug31100 |
| 21 | + */ |
| 22 | + function testBug31100FixSpecialName( $text, $expectedParam ) { |
| 23 | + $title = Title::newFromText( $text ); |
| 24 | + $fixed = $title->fixSpecialName(); |
| 25 | + $stuff = explode( '/', $fixed->getDbKey(), 2 ); |
| 26 | + if ( count( $stuff ) == 2 ) { |
| 27 | + $par = $stuff[1]; |
| 28 | + } else { |
| 29 | + $par = null; |
| 30 | + } |
| 31 | + $this->assertEquals( $expectedParam, $par, "Bug 31100 regression check: Title->fixSpecialName() should preserve parameter" ); |
| 32 | + } |
| 33 | + |
| 34 | + function dataBug31100() { |
| 35 | + return array( |
| 36 | + array( 'Special:Version', null ), |
| 37 | + array( 'Special:Version/', '' ), |
| 38 | + array( 'Special:Version/param', 'param' ), |
| 39 | + ); |
| 40 | + } |
19 | 41 | } |
Index: trunk/phase3/includes/Title.php |
— | — | @@ -4194,9 +4194,9 @@ |
4195 | 4195 | */ |
4196 | 4196 | public function fixSpecialName() { |
4197 | 4197 | if ( $this->getNamespace() == NS_SPECIAL ) { |
4198 | | - list( $canonicalName, /*...*/ ) = SpecialPageFactory::resolveAlias( $this->mDbkeyform ); |
| 4198 | + list( $canonicalName, $par ) = SpecialPageFactory::resolveAlias( $this->mDbkeyform ); |
4199 | 4199 | if ( $canonicalName ) { |
4200 | | - $localName = SpecialPageFactory::getLocalNameFor( $canonicalName ); |
| 4200 | + $localName = SpecialPageFactory::getLocalNameFor( $canonicalName, $par ); |
4201 | 4201 | if ( $localName != $this->mDbkeyform ) { |
4202 | 4202 | return Title::makeTitle( NS_SPECIAL, $localName ); |
4203 | 4203 | } |