Fixed bug in wfGeneralizeSQL() that caused strings in some queries to remain
authorMr. E23 <e23@users.mediawiki.org>
Wed, 19 Nov 2003 01:19:47 +0000 (01:19 +0000)
committerMr. E23 <e23@users.mediawiki.org>
Wed, 19 Nov 2003 01:19:47 +0000 (01:19 +0000)
includes/DatabaseFunctions.php

index 753d2c8..b566440 100644 (file)
@@ -200,9 +200,9 @@ function wfInvertTimestamp( $ts ) {
 function wfGeneralizeSQL( $sql )
 {
         # This could be done faster with some arrays and a single preg_replace,
-        # but this show more clearly what's going on. 
+        # but this show more clearly what's going on. Which may be a good thing.
+        $sql = preg_replace ( "/([\'\"])([^\\\\]|\\\\\\\\)*?\\1/", "\\1X\\1'", $sql);
         $sql = preg_replace ( "/-?\d+/" , "N", $sql);
-        $sql = preg_replace ( "/([\'\"]).+?[^\\\\]\\1/", "\\1X\\1", $sql);
         $sql = preg_replace ( "/\s+/", " ", $sql);
         return $sql;
 }