From: Brion Vibber Date: Tue, 31 Aug 2004 01:01:44 +0000 (+0000) Subject: Quote seemingly numeric values in SQL, as they might X-Git-Tag: 1.5.0alpha1~2192 X-Git-Url: http://git.cyclocoop.org/geomaker.php?a=commitdiff_plain;h=b8329819cf38012011cc07c814677c72887690a5;p=lhc%2Fweb%2Fwiklou.git Quote seemingly numeric values in SQL, as they might actually be strings which may not convert 1:1 if passed to MySQL as numbers. fix for Bug 255: Number articles on Special:Newpages http://bugzilla.wikipedia.org/show_bug.cgi?id=255 --- diff --git a/includes/Database.php b/includes/Database.php index acfab2bb90..b9640551ea 100644 --- a/includes/Database.php +++ b/includes/Database.php @@ -696,7 +696,11 @@ class Database { function addQuotes( $s ) { if ( is_null( $s ) ) { $s = 'NULL'; - } else if ( !is_numeric( $s ) ) { + } else { + # This will also quote numeric values. This should be harmless, + # and protects against weird problems that occur when they really + # _are_ strings such as article titles and string->number->string + # conversion is not 1:1. $s = "'" . $this->strencode( $s ) . "'"; } return $s;