diff options
author | Ilia Alshanetsky <iliaa@php.net> | 2004-07-27 16:40:43 +0000 |
---|---|---|
committer | Ilia Alshanetsky <iliaa@php.net> | 2004-07-27 16:40:43 +0000 |
commit | fe50278d0aecd2eacda3b5108abf87d0d4154513 (patch) | |
tree | f217f5c338fb1fb46e34328526d3cb903a57f950 /ext/sqlite/sqlite.c | |
parent | e9549a4f9cf7ca7d601dc0afde42de4308c851a8 (diff) | |
download | php-git-fe50278d0aecd2eacda3b5108abf87d0d4154513.tar.gz |
Fixed bug 29395 (sqlite_escape_string() returns bogus data on empty
strings).
Original Patch by: Tony
Diffstat (limited to 'ext/sqlite/sqlite.c')
-rw-r--r-- | ext/sqlite/sqlite.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/ext/sqlite/sqlite.c b/ext/sqlite/sqlite.c index 5e6c228ee9..fee732b0a6 100644 --- a/ext/sqlite/sqlite.c +++ b/ext/sqlite/sqlite.c @@ -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(); } } /* }}} */ |