Index: branches/REL1_18/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: branches/REL1_18/phase3/includes/Title.php |
— | — | @@ -4114,9 +4114,9 @@ |
4115 | 4115 | */ |
4116 | 4116 | public function fixSpecialName() { |
4117 | 4117 | if ( $this->getNamespace() == NS_SPECIAL ) { |
4118 | | - list( $canonicalName, /*...*/ ) = SpecialPageFactory::resolveAlias( $this->mDbkeyform ); |
| 4118 | + list( $canonicalName, $par ) = SpecialPageFactory::resolveAlias( $this->mDbkeyform ); |
4119 | 4119 | if ( $canonicalName ) { |
4120 | | - $localName = SpecialPageFactory::getLocalNameFor( $canonicalName ); |
| 4120 | + $localName = SpecialPageFactory::getLocalNameFor( $canonicalName, $par ); |
4121 | 4121 | if ( $localName != $this->mDbkeyform ) { |
4122 | 4122 | return Title::makeTitle( NS_SPECIAL, $localName ); |
4123 | 4123 | } |