]> granicus.if.org Git - php/commitdiff
MFH: Fixed bug 29395 (sqlite_escape_string() returns bogus data on empty
authorIlia Alshanetsky <iliaa@php.net>
Tue, 27 Jul 2004 16:40:46 +0000 (16:40 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Tue, 27 Jul 2004 16:40:46 +0000 (16:40 +0000)
strings).

NEWS
ext/sqlite/sqlite.c

diff --git a/NEWS b/NEWS
index 6beedd96821113c44e99f5b9fbbf32ee5a2765f6..f085050a50a9eb0caf9069a78ca45c819e787682 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -3,6 +3,8 @@ PHP                                                                        NEWS
 ?? ??? 2004, PHP 5.0.1
 - Fixed unloading of dynamically loaded extensions. 
   (Marcus, kameshj at fastmail dot fm)
+- Fixed bug 29395 (sqlite_escape_string() returns bogus data on empty
+  strings). (Ilia, Tony)
 - Fixed bug #29368 (The destructor is called when an exception is thrown from 
   the constructor). (Marcus)
 - Fixed bug #29335 (fetch functions now use MYSQLI_BOTH as default) (Georg)
index 5e6c228ee918d748b9af735d64f6d1fc7296006c..fee732b0a61fefbea50e24dcd4e93938e08ec884 100644 (file)
@@ -2680,12 +2680,14 @@ PHP_FUNCTION(sqlite_escape_string)
                enclen = php_sqlite_encode_binary(string, stringlen, ret+1);
                RETVAL_STRINGL(ret, enclen+1, 0);
                
-       } else  {
+       } else if (stringlen) {
                ret = sqlite_mprintf("%q", string);
                if (ret) {
                        RETVAL_STRING(ret, 1);
                        sqlite_freemem(ret);
                }
+       } else {
+               RETURN_EMPTY_STRING();
        }
 }
 /* }}} */