From: Ilia Alshanetsky Date: Tue, 27 Jul 2004 16:40:43 +0000 (+0000) Subject: Fixed bug 29395 (sqlite_escape_string() returns bogus data on empty X-Git-Tag: PRE_ZEND_VM_DISPATCH_PATCH~351 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=fe50278d0aecd2eacda3b5108abf87d0d4154513;p=php Fixed bug 29395 (sqlite_escape_string() returns bogus data on empty strings). Original Patch by: Tony --- 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(); } } /* }}} */