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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: sasf54 at gmail dot com
New email:
PHP Version: OS:

 

 [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

Add a Patch

Pull Requests

Add a Pull Request

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: Fri Apr 19 07:01:27 2024 UTC