From bf2ae270b5050fa537156e6558bd277ea1198233 Mon Sep 17 00:00:00 2001 From: "Mark A. Hershberger" Date: Thu, 21 Apr 2011 22:20:48 +0000 Subject: [PATCH] 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 --- includes/parser/Preprocessor_DOM.php | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) 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 ); -- 2.20.1