From 69e2b7946c764901ce49cf892782c958b884a71c Mon Sep 17 00:00:00 2001 From: Tim Starling Date: Wed, 12 Oct 2005 16:53:30 +0000 Subject: [PATCH] Fixed infinite loop in formatComment due to backreferences in preg_replace replacement string --- includes/Linker.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/includes/Linker.php b/includes/Linker.php index 84e1bdaefd..8da9612d08 100644 --- a/includes/Linker.php +++ b/includes/Linker.php @@ -726,6 +726,8 @@ class Linker { $match[1] = substr($match[1], 1); $thelink = $this->makeLink( $match[1], $text, "", $trail ); } + # Quote backreferences, then run preg_replace + $thelink = strtr( $thelink, array( "\\" => "\\\\", '$' => "\\$" ) ); $comment = preg_replace( $linkRegexp, $thelink, $comment, 1 ); } wfProfileOut( $fname ); -- 2.20.1