iliaa           Tue Mar  4 19:39:33 2008 UTC

  Modified files:              
    /php-src/ext/mssql  php_mssql.c 
  Log:
  
  MFB: Fixed bug #44325 (mssql_bind not correctly bind empty strings as
  parameter value)
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/mssql/php_mssql.c?r1=1.172&r2=1.173&diff_format=u
Index: php-src/ext/mssql/php_mssql.c
diff -u php-src/ext/mssql/php_mssql.c:1.172 php-src/ext/mssql/php_mssql.c:1.173
--- php-src/ext/mssql/php_mssql.c:1.172 Mon Dec 31 07:12:11 2007
+++ php-src/ext/mssql/php_mssql.c       Tue Mar  4 19:39:33 2008
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: php_mssql.c,v 1.172 2007/12/31 07:12:11 sebastian Exp $ */
+/* $Id: php_mssql.c,v 1.173 2008/03/04 19:39:33 iliaa Exp $ */
 
 #ifdef COMPILE_DL_MSSQL
 #define HAVE_MSSQL 1
@@ -2056,14 +2056,19 @@
 
        /* 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 */



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to