Fix r40194, which was obviously incorrect. There's no reason $sectionTitle should...
authorTim Starling <tstarling@users.mediawiki.org>
Mon, 1 Sep 2008 15:05:25 +0000 (15:05 +0000)
committerTim Starling <tstarling@users.mediawiki.org>
Mon, 1 Sep 2008 15:05:25 +0000 (15:05 +0000)
includes/Linker.php

index 3f8f802..cc02241 100644 (file)
@@ -1219,13 +1219,10 @@ class Linker {
                        if ( $local ) {
                                $sectionTitle = Title::newFromText( '#' . $section );
                        } else {
-                               $sectionTitle = clone( $title );
-                               $sectionTitle->mFragment = $section;
+                               $sectionTitle = Title::makeTitleSafe( $title->getNamespace(), 
+                                       $title->getDBkey(), $section );
                        }
-                       # FIXME: $sectionTitle should probably always be valid at this
-                       # point, but in some scenarios it's not (bug 15351).  Is this cor-
-                       # rect?
-                       if( $title instanceof Title ) {
+                       if ( $sectionTitle ) {
                                $link = $this->link( $sectionTitle,
                                        wfMsgForContent( 'sectionlink' ), array(), array(),
                                        'noclasses' );