From: Ilia Alshanetsky Date: Tue, 4 Mar 2008 19:39:08 +0000 (+0000) Subject: MFB: Fixed bug #44325 (mssql_bind not correctly bind empty strings as X-Git-Tag: php-5.2.6RC2~15 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c36af9e2b5e2d9a41f35902d1a71cd2626943904;p=php MFB: Fixed bug #44325 (mssql_bind not correctly bind empty strings as parameter value) --- diff --git a/NEWS b/NEWS index e8f50f2703..a2590d7718 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,8 @@ PHP NEWS ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| ?? Mar 2008, PHP 5.2.6 +- Fixed bug #44325 (mssql_bind not correctly bind empty strings as parameter + value). (Ilia) - Fixed bug #44306 (Better detection of MIPS processors on Windows). (Ilia) - Fixed bug #44166 (Parameter handling flaw in PDO::getAvailableDrivers()). (Ilia) 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 */