Revert r53832, r53897, r54145 "(bug 17988) Spaces before [[Category:]] links are...
authorBrion Vibber <brion@users.mediawiki.org>
Thu, 17 Sep 2009 00:57:10 +0000 (00:57 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Thu, 17 Sep 2009 00:57:10 +0000 (00:57 +0000)
Causes entire page to go blank under some circumstances.

includes/parser/Parser.php

index 85edf10..20af1c6 100644 (file)
@@ -1726,7 +1726,7 @@ class Parser
 
                                if ( $ns == NS_CATEGORY ) {
                                        wfProfileIn( __METHOD__."-category" );
-                                       $s = preg_replace( "/(\s*\n)+\s*$/D", '', $s ); # bug 87
+                                       $s = rtrim($s . "\n"); # bug 87
 
                                        if ( $wasblank ) {
                                                $sortkey = $this->getDefaultSort();
@@ -1742,7 +1742,7 @@ class Parser
                                         * Strip the whitespace Category links produce, see bug 87
                                         * @todo We might want to use trim($tmp, "\n") here.
                                         */
-                                       $s .= trim( $prefix . $trail, "\n" ) == '' ? '' : $prefix . $trail;
+                                       $s .= trim($prefix . $trail, "\n") == '' ? '': $prefix . $trail;
 
                                        wfProfileOut( __METHOD__."-category" );
                                        continue;