|  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
 [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: Fri Dec 08 10:01:28 2023 UTC