From: Marc Boeren Date: Wed, 30 Oct 2002 12:02:51 +0000 (+0000) Subject: escape_string functions will now return empty string directly. X-Git-Tag: php-4.3.0RC1~417 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7b9eae0e6eb2f180d8c727493d4730a7951af891;p=php escape_string functions will now return empty string directly. --- diff --git a/ext/dbx/dbx_fbsql.c b/ext/dbx/dbx_fbsql.c index 56c3764f0f..f12ed0870d 100644 --- a/ext/dbx/dbx_fbsql.c +++ b/ext/dbx/dbx_fbsql.c @@ -259,6 +259,10 @@ int dbx_fbsql_esc(zval **rv, zval **dbx_handle, zval **string, INTERNAL_FUNCTION char * tmpstr; int tmplen; + if (Z_STRLEN_PP(string) == 0) { + ZVAL_EMPTY_STRING(*rv); + return 1; + } tmpstr = estrdup(Z_STRVAL_PP(string)); tmplen = Z_STRLEN_PP(string); /* php_str_to_str uses a smart_str that allocates memory */ diff --git a/ext/dbx/dbx_mssql.c b/ext/dbx/dbx_mssql.c index 9ea38ca1eb..69ae42ba19 100644 --- a/ext/dbx/dbx_mssql.c +++ b/ext/dbx/dbx_mssql.c @@ -258,6 +258,10 @@ int dbx_mssql_esc(zval **rv, zval **dbx_handle, zval **string, INTERNAL_FUNCTION char * tmpstr; int tmplen; + if (Z_STRLEN_PP(string) == 0) { + ZVAL_EMPTY_STRING(*rv); + return 1; + } tmpstr = estrdup(Z_STRVAL_PP(string)); tmplen = Z_STRLEN_PP(string); /* php_str_to_str uses a smart_str that allocates memory */ diff --git a/ext/dbx/dbx_mysql.c b/ext/dbx/dbx_mysql.c index 3efd427038..b8149eae9d 100644 --- a/ext/dbx/dbx_mysql.c +++ b/ext/dbx/dbx_mysql.c @@ -266,6 +266,10 @@ int dbx_mysql_esc(zval **rv, zval **dbx_handle, zval **string, INTERNAL_FUNCTION char * tmpstr; int tmplen; + if (Z_STRLEN_PP(string) == 0) { + ZVAL_EMPTY_STRING(*rv); + return 1; + } arguments[0]=string; arguments[1]=dbx_handle; dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "mysql_real_escape_string", &returned_zval, number_of_arguments, arguments); diff --git a/ext/dbx/dbx_oci8.c b/ext/dbx/dbx_oci8.c index da50844334..bc69ee4553 100644 --- a/ext/dbx/dbx_oci8.c +++ b/ext/dbx/dbx_oci8.c @@ -276,6 +276,10 @@ int dbx_oci8_esc(zval **rv, zval **dbx_handle, zval **string, INTERNAL_FUNCTION_ char * tmpstr; int tmplen; + if (Z_STRLEN_PP(string) == 0) { + ZVAL_EMPTY_STRING(*rv); + return 1; + } tmpstr = estrdup(Z_STRVAL_PP(string)); tmplen = Z_STRLEN_PP(string); /* php_str_to_str uses a smart_str that allocates memory */ diff --git a/ext/dbx/dbx_odbc.c b/ext/dbx/dbx_odbc.c index 139855026b..ef3d575209 100644 --- a/ext/dbx/dbx_odbc.c +++ b/ext/dbx/dbx_odbc.c @@ -281,6 +281,10 @@ int dbx_odbc_esc(zval **rv, zval **dbx_handle, zval **string, INTERNAL_FUNCTION_ char * tmpstr; int tmplen; + if (Z_STRLEN_PP(string) == 0) { + ZVAL_EMPTY_STRING(*rv); + return 1; + } tmpstr = estrdup(Z_STRVAL_PP(string)); tmplen = Z_STRLEN_PP(string); /* php_str_to_str uses a smart_str that allocates memory */ diff --git a/ext/dbx/dbx_pgsql.c b/ext/dbx/dbx_pgsql.c index c8cac1908c..7642ee6488 100644 --- a/ext/dbx/dbx_pgsql.c +++ b/ext/dbx/dbx_pgsql.c @@ -285,6 +285,10 @@ int dbx_pgsql_esc(zval **rv, zval **dbx_handle, zval **string, INTERNAL_FUNCTION char * tmpstr; int tmplen; + if (Z_STRLEN_PP(string) == 0) { + ZVAL_EMPTY_STRING(*rv); + return 1; + } tmpstr = estrdup(Z_STRVAL_PP(string)); tmplen = Z_STRLEN_PP(string); /* php_str_to_str uses a smart_str that allocates memory */ diff --git a/ext/dbx/dbx_sybasect.c b/ext/dbx/dbx_sybasect.c index 3cc4830165..b5da105651 100644 --- a/ext/dbx/dbx_sybasect.c +++ b/ext/dbx/dbx_sybasect.c @@ -283,6 +283,10 @@ int dbx_sybasect_esc(zval **rv, zval **dbx_handle, zval **string, INTERNAL_FUNCT char * tmpstr; int tmplen; + if (Z_STRLEN_PP(string) == 0) { + ZVAL_EMPTY_STRING(*rv); + return 1; + } tmpstr = estrdup(Z_STRVAL_PP(string)); tmplen = Z_STRLEN_PP(string); /* php_str_to_str uses a smart_str that allocates memory */