From: mpb dot mail at gmail dot com
Operating system: FreeBSD 4.x
PHP version: 4.4.2
PHP Bug Type: SQLite related
Bug description: sqlite_escape_string on '' or null returns wrong value
Description:
------------
sqlite_escape_string on '' (the empty string) or null returns the wrong
value.
I would guess that:
sqlite_escape_string ('') should return '',
and
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.
http://bugs.php.net/bug.php?id=29339
http://bugs.php.net/bug.php?id=29395
Reproduce code:
---------------
<?php
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:
----------------
787878
done
Actual result:
--------------
787878
ac7878
ac7878
done
--
Edit bug report at http://bugs.php.net/?id=36867&edit=1
--
Try a CVS snapshot (PHP 4.4):
http://bugs.php.net/fix.php?id=36867&r=trysnapshot44
Try a CVS snapshot (PHP 5.1):
http://bugs.php.net/fix.php?id=36867&r=trysnapshot51
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=36867&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=36867&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=36867&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=36867&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=36867&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=36867&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=36867&r=support
Expected behavior: http://bugs.php.net/fix.php?id=36867&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=36867&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=36867&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=36867&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=36867&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=36867&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=36867&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=36867&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=36867&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=36867&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=36867&r=mysqlcfg