diff options
| author | Ilia Alshanetsky <iliaa@php.net> | 2008-03-04 19:39:08 +0000 |
|---|---|---|
| committer | Ilia Alshanetsky <iliaa@php.net> | 2008-03-04 19:39:08 +0000 |
| commit | c36af9e2b5e2d9a41f35902d1a71cd2626943904 (patch) | |
| tree | 9990b4dd15b78f8acbcdae198a403fdcac342a46 /ext/mssql/php_mssql.c | |
| parent | 6d48ddaf8f46cc9a90f47753400cbe7fdde78f62 (diff) | |
| download | php-git-c36af9e2b5e2d9a41f35902d1a71cd2626943904.tar.gz | |
MFB: Fixed bug #44325 (mssql_bind not correctly bind empty strings as
parameter value)
Diffstat (limited to 'ext/mssql/php_mssql.c')
| -rw-r--r-- | ext/mssql/php_mssql.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/ext/mssql/php_mssql.c b/ext/mssql/php_mssql.c index c91b98d7dd..7ad75912f2 100644 --- a/ext/mssql/php_mssql.c +++ b/ext/mssql/php_mssql.c @@ -2063,14 +2063,19 @@ PHP_FUNCTION(mssql_bind) /* modify datalen and maxlen according to dbrpcparam documentation */ if ( (type==SQLVARCHAR) || (type==SQLCHAR) || (type==SQLTEXT) ) { /* variable-length type */ - if (is_null) { + if (is_null || Z_TYPE_PP(var) == IS_NULL) { maxlen=0; datalen=0; - } - else { + } else { convert_to_string_ex(var); - datalen=Z_STRLEN_PP(var); - value=(LPBYTE)Z_STRVAL_PP(var); + datalen = Z_STRLEN_PP(var); + value = (LPBYTE)Z_STRVAL_PP(var); + if (!datalen) { + datalen = 1; + if (maxlen == -1) { + maxlen = 1; + } + } } } else { /* fixed-length type */ |
