r86676 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r86675‎ | r86676 | r86677 >
Date:22:20, 21 April 2011
Author:mah
Status:resolved (Comments)
Tags:
Comment:
Fix bug #28642 - wrong part->commentEnd set to abbutting comments

To be able to search for headline-closing equal sign even when
there are comments between the last = and the linebreak, there are
some position values appended to the recent domParts. This works
well with the first comment, but as soon as a second one comes,
the commentEnd value is set to $wsEnd instead of $endPos.

Patch from Bergi
Modified paths:
  • /trunk/phase3/includes/parser/Preprocessor_DOM.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/parser/Preprocessor_DOM.php
@@ -343,13 +343,11 @@
344344
345345 if ( $stack->top ) {
346346 $part = $stack->top->getCurrentPart();
347 - if ( isset( $part->commentEnd ) && $part->commentEnd == $wsStart - 1 ) {
348 - // Comments abutting, no change in visual end
349 - $part->commentEnd = $wsEnd;
350 - } else {
 347+ $part->commentEnd = $endPos;
 348+ if ( ! (isset( $part->commentEnd ) && $part->commentEnd == $wsStart - 1 )) {
351349 $part->visualEnd = $wsStart;
352 - $part->commentEnd = $endPos;
353350 }
 351+ // Else comments abutting, no change in visual end
354352 }
355353 $i = $endPos + 1;
356354 $inner = substr( $text, $startPos, $endPos - $startPos + 1 );

Follow-up revisions

RevisionCommit summaryAuthorDate
r86709Updated patch from Bergi re: r86676 with tested code to fix bug #28642mah14:25, 22 April 2011
r86795* Add preprocessor tests that Bergi supplied for Bug #28642...mah21:26, 23 April 2011
r87228Apply r86676+r86709 changes to the native preprocessor.platonides22:28, 1 May 2011

Comments

#Comment by Nikerabbit (talk | contribs)   07:41, 22 April 2011

No tests?

#Comment by Brion VIBBER (talk | contribs)   18:14, 21 June 2011

Ok with fixed in r86709 and test cases in r86795.

Status & tagging log