Fixed infinite loop in formatComment due to backreferences in preg_replace replacemen...
authorTim Starling <tstarling@users.mediawiki.org>
Wed, 12 Oct 2005 16:53:30 +0000 (16:53 +0000)
committerTim Starling <tstarling@users.mediawiki.org>
Wed, 12 Oct 2005 16:53:30 +0000 (16:53 +0000)
includes/Linker.php

index 84e1bda..8da9612 100644 (file)
@@ -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 );