From: Mr. E23 Date: Wed, 19 Nov 2003 17:09:42 +0000 (+0000) Subject: Fixed another bug in wfGeneralizeSQL(). This time it's perfect. X-Git-Tag: 1.1.0~128 X-Git-Url: http://git.cyclocoop.org/data/%7BGarradin/WEBSITE%7D?a=commitdiff_plain;h=ed60944f12600df9a711632b3563d995f35e5c72;p=lhc%2Fweb%2Fwiklou.git Fixed another bug in wfGeneralizeSQL(). This time it's perfect. --- diff --git a/includes/DatabaseFunctions.php b/includes/DatabaseFunctions.php index ebd9b798ca..854a3c04b7 100644 --- a/includes/DatabaseFunctions.php +++ b/includes/DatabaseFunctions.php @@ -199,12 +199,12 @@ function wfInvertTimestamp( $ts ) { # It's only slightly flawed. Don't use for anything important. 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. Which may be a good thing. - $sql = preg_replace ( "/([\'\"])([^\\\\]|\\\\\\\\)*?\\1/", "\\1X\\1", $sql); - $sql = preg_replace ( "/-?\d+/" , "N", $sql); - $sql = preg_replace ( "/\s+/", " ", $sql); - return $sql; + # This could be done faster with some arrays and a single preg_replace, + # but this show more clearly what's going on. Which may be a good thing. + $sql = preg_replace ( "/'([^\\\\']|\\\\.)*'|\"([^\\\\\"]|\\\\.)*\"/", "'X'", $sql); + $sql = preg_replace ( "/-?\d+/" , "N", $sql); + $sql = preg_replace ( "/\s+/", " ", $sql); + return $sql; } function wfFieldExists( $table, $field )