Index: trunk/phase3/includes/Skin.php |
— | — | @@ -1244,6 +1244,12 @@ |
1245 | 1245 | if ( strpos( $line, '|' ) !== false ) { // sanity check |
1246 | 1246 | $line = MessageCache::singleton()->transform( $line, false, null, $this->getTitle() ); |
1247 | 1247 | $line = array_map( 'trim', explode( '|', $line, 2 ) ); |
| 1248 | + if ( count( $line ) !== 2 ) { |
| 1249 | + // Second sanity check, could be hit by people doing |
| 1250 | + // funky stuff with parserfuncs... (bug 3321) |
| 1251 | + continue; |
| 1252 | + } |
| 1253 | + |
1248 | 1254 | $extraAttribs = array(); |
1249 | 1255 | |
1250 | 1256 | $msgLink = $this->msg( $line[0] )->inContentLanguage(); |
— | — | @@ -1255,7 +1261,6 @@ |
1256 | 1262 | } else { |
1257 | 1263 | $link = $line[0]; |
1258 | 1264 | } |
1259 | | - |
1260 | 1265 | $msgText = $this->msg( $line[1] ); |
1261 | 1266 | if ( $msgText->exists() ) { |
1262 | 1267 | $text = $msgText->text(); |
Index: trunk/phase3/tests/phpunit/skins/SideBarTest.php |
— | — | @@ -106,8 +106,38 @@ |
107 | 107 | ); |
108 | 108 | |
109 | 109 | } |
| 110 | + /** bug 33321 */ |
| 111 | + function testTrickyPipe() { |
| 112 | + $this->assertSidebar( |
| 113 | + array( 'Title' => array( |
| 114 | + # The first 2 are skipped |
| 115 | + # Doesn't really test the url properly |
| 116 | + # because it will vary with $wgArticlePath et al. |
| 117 | + # ** Baz|Fred |
| 118 | + array( |
| 119 | + 'text' => 'Fred', |
| 120 | + 'href' => Title::newFromText( 'Baz' )->getLocalUrl(), |
| 121 | + 'id' => 'n-Fred', |
| 122 | + 'active' => null, |
| 123 | + ), |
| 124 | + array( |
| 125 | + 'text' => 'title-to-display', |
| 126 | + 'href' => Title::newFromText( 'page-to-go-to' )->getLocalUrl(), |
| 127 | + 'id' => 'n-title-to-display', |
| 128 | + 'active' => null, |
| 129 | + ), |
| 130 | + )), |
| 131 | +'* Title |
| 132 | +** {{PAGENAME|Foo}} |
| 133 | +** Bar |
| 134 | +** Baz|Fred |
| 135 | +** {{PLURAL:1|page-to-go-to{{int:pipe-separator/en}}title-to-display|branch not taken}} |
| 136 | +' |
| 137 | + ); |
110 | 138 | |
| 139 | + } |
111 | 140 | |
| 141 | + |
112 | 142 | #### Attributes for external links ########################## |
113 | 143 | private function getAttribs( ) { |
114 | 144 | # Sidebar text we will use everytime |
Index: trunk/phase3/RELEASE-NOTES-1.19 |
— | — | @@ -218,6 +218,9 @@ |
219 | 219 | HTTPS when the local wiki is served over HTTPS. |
220 | 220 | * (bug 33525) clearTagHooks doesn't clear function hooks. |
221 | 221 | * (bug 33523) Function tag hooks don't appear on Special:Version. |
| 222 | +* (bug 33321) Adding a line to MediaWiki:Sidebar that contains a pipe, but doesn't |
| 223 | + have any pipes after being transformed by MessageCache, causes exception on |
| 224 | + all pages. |
222 | 225 | |
223 | 226 | === API changes in 1.19 === |
224 | 227 | * (bug 19838) siprop=interwikimap can now use the interwiki cache. |