Quote namespace names before plonking them into a regular expression, to give me...
authorRob Church <robchurch@users.mediawiki.org>
Sun, 3 Dec 2006 04:09:48 +0000 (04:09 +0000)
committerRob Church <robchurch@users.mediawiki.org>
Sun, 3 Dec 2006 04:09:48 +0000 (04:09 +0000)
includes/Linker.php

index b54c426..f7b5c0a 100644 (file)
@@ -931,8 +931,8 @@ class Linker {
 
                # format regular and media links - all other wiki formatting
                # is ignored
-               $medians = '(?:' . Namespace::getCanonicalName( NS_MEDIA ) . '|';
-               $medians .= $wgContLang->getNsText( NS_MEDIA ) . '):';
+               $medians = '(?:' . preg_quote( Namespace::getCanonicalName( NS_MEDIA ), '/' ) . '|';
+               $medians .= preg_quote( $wgContLang->getNsText( NS_MEDIA ), '/' ) . '):';
                while(preg_match('/\[\[(.*?)(\|(.*?))*\]\](.*)$/',$comment,$match)) {
                        # Handle link renaming [[foo|text]] will show link as "text"
                        if( "" != $match[3] ) {