php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #71294 real_escape_string(0) -> NULL
Submitted: 2016-01-06 06:24 UTC Modified: 2016-01-06 19:32 UTC
From: sasf54 at gmail dot com Assigned:
Status: Not a bug Package: MySQLi related
PHP Version: 5.6.16 OS: Linux - Gentoo
Private report: No CVE-ID: None
 [2016-01-06 06:24 UTC] sasf54 at gmail dot com
Description:
------------
$CONNECTION = new mysqli($this->CFG->db_host, $this->CFG->db_user, $this->CFG->db_pass, $this->CFG->db_dbname, $this->CFG->db_port);
echo $CONNECTION->real_escape_string(0);

Expected result:
----------------
real_escape_string(0) => 0

Actual result:
--------------
real_escape_string(0) => NULL
(Mysql server has issues with this, if used in update)

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-01-06 06:38 UTC] requinix@php.net
-Status: Open +Status: Feedback
 [2016-01-06 06:38 UTC] requinix@php.net
Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves. 

A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external 
resources such as databases, etc. If the script requires a 
database to demonstrate the issue, please make sure it creates 
all necessary tables, stored procedures etc.

Please avoid embedding huge scripts into the report.


 [2016-01-06 06:39 UTC] requinix@php.net
because it sounds like you're saying the output is the string "NULL".
 [2016-01-06 07:14 UTC] sasf54 at gmail dot com
-Status: Feedback +Status: Open
 [2016-01-06 07:14 UTC] sasf54 at gmail dot com
requinix@php.net: No, the output is NULL (not string)
Mysql error: column XXX cannot be NULL
as generated the full sql:
update TABLE set VAL1=NULL, VAL2="valid' where id=123;
(VAL1 cannot be null (for example, boolean, tinyint(1)))
 [2016-01-06 07:22 UTC] sasf54 at gmail dot com
-Status: Open +Status: Closed
 [2016-01-06 07:22 UTC] sasf54 at gmail dot com
Sorry for bothering, found the bug in my DB access code....
 [2016-01-06 19:32 UTC] requinix@php.net
-Status: Closed +Status: Not a bug
 [2016-01-06 19:32 UTC] requinix@php.net
.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 13:01:31 2024 UTC