Escape forward slashes in search terms, otherwise PHP thinks the regex has ended...
authorGreg Sabino Mullane <greg@users.mediawiki.org>
Thu, 17 Apr 2008 15:38:26 +0000 (15:38 +0000)
committerGreg Sabino Mullane <greg@users.mediawiki.org>
Thu, 17 Apr 2008 15:38:26 +0000 (15:38 +0000)
RELEASE-NOTES
includes/SearchEngine.php

index 6ddf2bd..33d9d0c 100644 (file)
@@ -190,6 +190,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
 * (bug 13756) Don't show the form and navigation links of Special:Newpages if
   the page is included
 * When hiding things on WhatLinksHere, generated URLs should hide them too
+* Properly escape search terms with forward slashes so they appear highlighted 
+  in search results.
 
 
 === API changes in 1.13 ===
index d802a7f..864be9d 100644 (file)
@@ -571,6 +571,7 @@ class SearchResult {
                $lines = explode( "\n", $text );
                
                $terms = implode( '|', $terms );
+               $terms = str_replace( '/', "\\/", $terms);
                $max = intval( $contextchars ) + 1;
                $pat1 = "/(.*)($terms)(.{0,$max})/i";