php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #36692 Incorrect term in mysql_real_escape_string's manual page.
Submitted: 2006-03-11 01:26 UTC Modified: 2006-03-11 12:53 UTC
Votes:6
Avg. Score:4.7 ± 0.7
Reproduced:6 of 6 (100.0%)
Same Version:6 (100.0%)
Same OS:6 (100.0%)
From: nobody at example dot com Assigned:
Status: Closed Package: Documentation problem
PHP Version: Irrelevant OS: irrelevant
Private report: No CVE-ID: None
 [2006-03-11 01:26 UTC] nobody at example dot com
Description:
------------
On the documentation for mysql_real_escape_string at http://us2.php.net/manual/en/function.mysql-real-escape-string.php :

// Quote if not integer
if (!is_numeric($value)) {
  $value = "'" . mysql_real_escape_string($value) . "'";
}


This is blatantly incorrect.  is_numeric() does *not* test whether something is an integer.  This should probably be int() or ctype_digit() instead.


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-03-11 01:28 UTC] nobody at example dot com
is_int(), not int().
 [2006-03-11 12:41 UTC] colder@php.net
Ok, tiny patch:

http://www.colder.ch/patches/mysql-real-escape-string.patch


Index: en/reference/mysql/functions/mysql-real-escape-string.xml
===================================================================
RCS file: /repository/phpdoc/en/reference/mysql/functions/mysql-real-escape-string.xml,v
retrieving revision 1.25
diff -u -r1.25 mysql-real-escape-string.xml
--- en/reference/mysql/functions/mysql-real-escape-string.xml	3 Jan 2006 08:46:20 -0000	1.25
+++ en/reference/mysql/functions/mysql-real-escape-string.xml	11 Mar 2006 11:34:09 -0000
@@ -128,7 +128,7 @@
     if (get_magic_quotes_gpc()) {
         $value = stripslashes($value);
     }
-    // Quote if not integer
+    // Quote if not a number or a numeric string
     if (!is_numeric($value)) {
         $value = "'" . mysql_real_escape_string($value) . "'";
     }
 [2006-03-11 12:53 UTC] vrana@php.net
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.


 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Mon Jul 07 12:01:35 2025 UTC