Fixed api.php?action=parse&format=xmlfm hitting PCRE limit.
authorMax Semenik <maxsem.wiki@gmail.com>
Mon, 2 Apr 2012 14:21:26 +0000 (18:21 +0400)
committerAntoine Musso <hashar@free.fr>
Tue, 3 Apr 2012 09:19:14 +0000 (11:19 +0200)
By the way, regexes weren't needed here at all.

Change-Id: I41d222a4d60ead3655f7565b6703186abcd223e0

includes/api/ApiFormatBase.php

index 57c641d..17e9225 100644 (file)
@@ -260,7 +260,8 @@ See the <a href='https://www.mediawiki.org/wiki/API'>complete documentation</a>,
                $text = htmlspecialchars( $text );
 
                // encode all comments or tags as safe blue strings
-               $text = preg_replace( '/\&lt;(!--.*?--|.*?)\&gt;/', '<span style="color:blue;">&lt;\1&gt;</span>', $text );
+               $text = str_replace( '&lt;', '<span style="color:blue;">&lt;', $text );
+               $text = str_replace( '&gt;', '&gt;</span>', $text );
                // identify URLs
                $protos = wfUrlProtocolsWithoutProtRel();
                // This regex hacks around bug 13218 (&quot; included in the URL)