* Linker::formatComment corrupted the passed title object on PHP 5
authorBrion Vibber <brion@users.mediawiki.org>
Fri, 13 Jan 2006 19:58:23 +0000 (19:58 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Fri, 13 Jan 2006 19:58:23 +0000 (19:58 +0000)
  if the comment included a section link. Use clone() to make a safe copy.

RELEASE-NOTES
includes/Linker.php

index f76979a..54891e6 100644 (file)
@@ -479,6 +479,8 @@ fully support the editing toolbar, but was found to be too confusing.
   content loading and viewing, for clarity and consistency.
 * (bug 4104) 'OutputPageBeforeHTML' hook to postprocess article HTML on
   page view (comes after parser cache, if used). Patch by ThomasV.
+* Linker::formatComment corrupted the passed title object on PHP 5
+  if the comment included a section link. Use clone() to make a safe copy.
 
 
 === Caveats ===
index bfe45eb..ffe062e 100644 (file)
@@ -663,7 +663,7 @@ class Linker {
         * comments. It escapes any HTML in the comment, but adds some CSS to format
         * auto-generated comments (from section editing) and formats [[wikilinks]].
         *
-        * The &$title parameter must be a title OBJECT. It is used to generate a
+        * The $title parameter must be a title OBJECT. It is used to generate a
         * direct link to the section in the autocomment.
         * @author Erik Moeller <moeller@scireview.de>
         *
@@ -688,14 +688,15 @@ class Linker {
                        $auto=$match[2];
                        $post=$match[3];
                        $link='';
-                       if($title) {
-                               $section=$auto;
+                       if( $title ) {
+                               $section = $auto;
 
                                # This is hackish but should work in most cases.
-                               $section=str_replace('[[','',$section);
-                               $section=str_replace(']]','',$section);
-                               $title->mFragment=$section;
-                               $link=$this->makeKnownLinkObj($title,wfMsg('sectionlink'));
+                               $section = str_replace( '[[', '', $section );
+                               $section = str_replace( ']]', '', $section );
+                               $sectionTitle = clone( $title );
+                               $sectionTitle->mFragment = $section;
+                               $link = $this->makeKnownLinkObj( $sectionTitle, wfMsg( 'sectionlink' ) );
                        }
                        $sep='-';
                        $auto=$link.$auto;