r40194 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r40193‎ | r40194 | r40195 >
Date:23:12, 28 August 2008
Author:simetrical
Status:old
Tags:
Comment:
(bug 15351) Fix fatal error for invalid section fragments in autocomments

. . . probably. Actually I can't reproduce the problem, so I can't be sure if this fixes it. But it should. I'm not at all sure if this is a real fix or more of a workaround. One code path (!$local) normalizes the fragment and rejects it as invalid, while the other code path ($local) sets the fragment unquestioningly and doesn't validate it. I don't know which behavior is correct.
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/Linker.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Linker.php
@@ -1222,11 +1222,18 @@
12231223 $sectionTitle = clone( $title );
12241224 $sectionTitle->mFragment = $section;
12251225 }
1226 - $link = $this->link( $sectionTitle,
1227 - wfMsgForContent( 'sectionlink' ), array(), array(),
1228 - 'noclasses' );
 1226+ # FIXME: $sectionTitle should probably always be valid at this
 1227+ # point, but in some scenarios it's not (bug 15351). Is this cor-
 1228+ # rect?
 1229+ if( $title instanceof Title ) {
 1230+ $link = $this->link( $sectionTitle,
 1231+ wfMsgForContent( 'sectionlink' ), array(), array(),
 1232+ 'noclasses' );
 1233+ } else {
 1234+ $link = '';
 1235+ }
12291236 }
1230 - $auto = $link . $auto;
 1237+ $auto = "$link$auto";
12311238 if( $pre ) {
12321239 # written summary $presep autocomment (summary /* section */)
12331240 $auto = wfMsgExt( 'autocomment-prefix', array( 'escapenoentities', 'content' ) ) . $auto;
Index: trunk/phase3/RELEASE-NOTES
@@ -157,6 +157,7 @@
158158 namespace in Special:Watchlist
159159 * (bug 15172) 'Go' button of Special:Recentchanges now on the same line as the
160160 last input element (like Special:Watchlist too)
 161+* (bug 15351) Fix fatal error for invalid section fragments in autocomments
161162
162163
163164 === API changes in 1.14 ===

Follow-up revisions

RevisionCommit summaryAuthorDate
r40305Fix r40194, which was obviously incorrect. There's no reason $sectionTitle sh...tstarling15:05, 1 September 2008