From: Mark A. Hershberger Date: Thu, 21 Apr 2011 22:20:48 +0000 (+0000) Subject: Fix bug #28642 - wrong part->commentEnd set to abbutting comments X-Git-Tag: 1.31.0-rc.0~30642 X-Git-Url: http://git.cyclocoop.org/%22.%24h.%22?a=commitdiff_plain;h=bf2ae270b5050fa537156e6558bd277ea1198233;p=lhc%2Fweb%2Fwiklou.git 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 --- diff --git a/includes/parser/Preprocessor_DOM.php b/includes/parser/Preprocessor_DOM.php index 2587510dea..907cbd0759 100644 --- a/includes/parser/Preprocessor_DOM.php +++ b/includes/parser/Preprocessor_DOM.php @@ -343,13 +343,11 @@ class Preprocessor_DOM implements Preprocessor { if ( $stack->top ) { $part = $stack->top->getCurrentPart(); - if ( isset( $part->commentEnd ) && $part->commentEnd == $wsStart - 1 ) { - // Comments abutting, no change in visual end - $part->commentEnd = $wsEnd; - } else { + $part->commentEnd = $endPos; + if ( ! (isset( $part->commentEnd ) && $part->commentEnd == $wsStart - 1 )) { $part->visualEnd = $wsStart; - $part->commentEnd = $endPos; } + // Else comments abutting, no change in visual end } $i = $endPos + 1; $inner = substr( $text, $startPos, $endPos - $startPos + 1 );