From 25b0bce762fd4d5c84a63ca62d69ba67ee6200be Mon Sep 17 00:00:00 2001 From: Tim Starling Date: Mon, 6 Aug 2018 12:30:51 +1000 Subject: [PATCH] RemexCompatMunger: Don't call endTag() in case B/b MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This was naïve, the linked bug documents a case where endTag() was called despite children of the p-wrap still being in TreeBuilder's stack. Instead, wait for the parent of the p-wrap to have endTag() called on it, I've submitted a patch which will clean up the node in that case. Bug: T200827 Change-Id: I34694813eace9cadabf2db8f9ccca83d1368cfad (cherry picked from commit 10c8cfea305ec1d450b16ad54ebddb5f910016f4) --- includes/tidy/RemexCompatMunger.php | 1 - tests/phpunit/includes/tidy/RemexDriverTest.php | 5 +++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/includes/tidy/RemexCompatMunger.php b/includes/tidy/RemexCompatMunger.php index ab2ba46de9..e6351e2e31 100644 --- a/includes/tidy/RemexCompatMunger.php +++ b/includes/tidy/RemexCompatMunger.php @@ -262,7 +262,6 @@ class RemexCompatMunger implements TreeHandler { $pElement = $parentData->childPElement; $parentData->childPElement = null; $newRef = $refElement->userData; - $this->endTag( $pElement, $sourceStart, 0 ); } elseif ( $under && $parentData->isSplittable && (bool)$parentData->ancestorPNode !== $inline ) { diff --git a/tests/phpunit/includes/tidy/RemexDriverTest.php b/tests/phpunit/includes/tidy/RemexDriverTest.php index b20557f2a8..a5ebaa5ddc 100644 --- a/tests/phpunit/includes/tidy/RemexDriverTest.php +++ b/tests/phpunit/includes/tidy/RemexDriverTest.php @@ -257,6 +257,11 @@ class RemexDriverTest extends MediaWikiTestCase { '
x
', '

x

', ], + [ + 'p-wrap ended by reparenting (T200827)', + '

', + '

', + ], ]; public function provider() { -- 2.20.1