summaryrefslogtreecommitdiff
path: root/ext/sqlite
diff options
context:
space:
mode:
authorIlia Alshanetsky <iliaa@php.net>2004-07-27 16:40:46 +0000
committerIlia Alshanetsky <iliaa@php.net>2004-07-27 16:40:46 +0000
commitf76ce400eb63c56d824c5ddbb367f4ce56b181ac (patch)
tree571810a6caf71ab785f06c478439d6405739add8 /ext/sqlite
parent16204148bbb584dc8f4f6b4f13624b11e00bef46 (diff)
downloadphp-git-f76ce400eb63c56d824c5ddbb367f4ce56b181ac.tar.gz
MFH: Fixed bug 29395 (sqlite_escape_string() returns bogus data on empty
strings).
Diffstat (limited to 'ext/sqlite')
-rw-r--r--ext/sqlite/sqlite.c4
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();
}
}
/* }}} */