From 0b82162149795cc16fc7ccce802c4e8690b14cc3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartosz=20Dziewo=C5=84ski?= Date: Mon, 19 Apr 2021 22:33:45 +0200 Subject: [PATCH] CommentFormatter: Fix regexp in topic subscription postprocessing The regexps needs to be non-greedy, otherwise it could swallow up a large chunk of the page (up to the next comment). I noticed this when adding tests for this code, in the 'unclosed-font' test case (Ief9648b8805fadcc170c54b627eb669cc8b907b6). Change-Id: I5f67a9599b0cb07bdd53abeebac9ada221181b66 --- includes/CommentFormatter.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/CommentFormatter.php b/includes/CommentFormatter.php index 3f0ec7f48..2057b752b 100644 --- a/includes/CommentFormatter.php +++ b/includes/CommentFormatter.php @@ -214,7 +214,7 @@ class CommentFormatter { ) : string { $doc = new DOMDocument(); $text = preg_replace_callback( - '//', + '//', function ( $matches ) use ( $doc, $subscriptionStore, $user ) { $itemName = $matches[1]; $items = $subscriptionStore->getSubscriptionItemsForUser(