iliaa           Tue Mar  4 19:39:09 2008 UTC

  Modified files:              (Branch: PHP_5_2)
    /php-src/ext/mssql  php_mssql.c 
    /php-src    NEWS 
  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.152.2.13.2.6&r2=1.152.2.13.2.7&diff_format=u
Index: php-src/ext/mssql/php_mssql.c
diff -u php-src/ext/mssql/php_mssql.c:1.152.2.13.2.6 
php-src/ext/mssql/php_mssql.c:1.152.2.13.2.7
--- php-src/ext/mssql/php_mssql.c:1.152.2.13.2.6        Mon Dec 31 07:20:08 2007
+++ php-src/ext/mssql/php_mssql.c       Tue Mar  4 19:39:08 2008
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: php_mssql.c,v 1.152.2.13.2.6 2007/12/31 07:20:08 sebastian Exp $ */
+/* $Id: php_mssql.c,v 1.152.2.13.2.7 2008/03/04 19:39:08 iliaa Exp $ */
 
 #ifdef COMPILE_DL_MSSQL
 #define HAVE_MSSQL 1
@@ -2063,14 +2063,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 */
http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.1104&r2=1.2027.2.547.2.1105&diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.547.2.1104 php-src/NEWS:1.2027.2.547.2.1105
--- php-src/NEWS:1.2027.2.547.2.1104    Mon Mar  3 21:14:19 2008
+++ php-src/NEWS        Tue Mar  4 19:39:08 2008
@@ -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)



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

Reply via email to