From: Tim Starling Date: Wed, 12 Oct 2005 16:53:30 +0000 (+0000) Subject: Fixed infinite loop in formatComment due to backreferences in preg_replace replacemen... X-Git-Tag: 1.6.0~1445 X-Git-Url: http://git.cyclocoop.org//%27http:/jquery.khurshid.com/ifixpng.php/%27?a=commitdiff_plain;h=69e2b7946c764901ce49cf892782c958b884a71c;p=lhc%2Fweb%2Fwiklou.git Fixed infinite loop in formatComment due to backreferences in preg_replace replacement string --- 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 );