|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #36867 sqlite_escape_string on '' or null returns wrong value
Submitted: 2006-03-27 02:30 UTC Modified: 2006-03-27 09:51 UTC
From: mpb dot mail at gmail dot com Assigned:
Status: Closed Package: SQLite related
PHP Version: 4.4.2 OS: FreeBSD 4.x
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.
Block user comment
Status: Assign to:
Bug Type:
From: mpb dot mail at gmail dot com
New email:
PHP Version: OS:


 [2006-03-27 02:30 UTC] mpb dot mail at gmail dot com
sqlite_escape_string on '' (the empty string) or null returns the wrong value.

I would guess that:

sqlite_escape_string ('') should return '',


sqlite_escape_string (null) should return null.

Additionally, you can see that what sqlite_escape_string actually does return in these cases is a mangled version of the previous non-null input string.

This bug appears to have been fixed in PHP5, but not yet in PHP4.

Reproduce code:

print bin2hex (sqlite_escape_string ('xxx')). "\n";
print bin2hex (sqlite_escape_string ('')).    "\n";
print bin2hex (sqlite_escape_string (null)).  "\n";
print "done\n";


Expected result:


Actual result:


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2006-03-27 04:18 UTC] scottmacvicar at ntlworld dot com
This was fixed in the PECL CVS there just happens to have been no release since the bug was fixed.

Last release was 18th July 2004, the bug was fixed 27th July 2004.

If you compile a CVS copy it will work fine.

Perhaps Wez can make another release.
 [2006-03-27 09:51 UTC]
Works fine -> closed.
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Sat Dec 02 09:01:27 2023 UTC