iliaa           Tue Jun 26 01:24:10 2007 UTC

  Added files:                 (Branch: PHP_5_2)
    /php-src/ext/pdo_mysql/tests        bug_41698.phpt 

  Modified files:              
    /php-src    NEWS 
    /php-src/ext/pdo    pdo_stmt.c 
  Log:
  
  Fixed bug #41698 (float parameters truncated to integer in prepared 
  statements).
  
http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.799&r2=1.2027.2.547.2.800&diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.547.2.799 php-src/NEWS:1.2027.2.547.2.800
--- php-src/NEWS:1.2027.2.547.2.799     Mon Jun 25 21:12:47 2007
+++ php-src/NEWS        Tue Jun 26 01:24:09 2007
@@ -45,6 +45,8 @@
 - Fixed bug #41717 (imagepolygon does not respect thickness). (Pierre)
 - Fixed bug #41711 (NULL temporary lobs not supported in OCI8). 
   (Chris Jones, Tony)
+- Fixed bug #41698 (float parameters truncated to integer in prepared 
+  statements). (Ilia)
 - Fixed bug #41686 (Omitting length param in array_slice not possible).
   (Ilia)
 - Fixed bug #41685 (array_push() fails to warn when next index is already
http://cvs.php.net/viewvc.cgi/php-src/ext/pdo/pdo_stmt.c?r1=1.118.2.38.2.18&r2=1.118.2.38.2.19&diff_format=u
Index: php-src/ext/pdo/pdo_stmt.c
diff -u php-src/ext/pdo/pdo_stmt.c:1.118.2.38.2.18 
php-src/ext/pdo/pdo_stmt.c:1.118.2.38.2.19
--- php-src/ext/pdo/pdo_stmt.c:1.118.2.38.2.18  Wed May 16 20:04:32 2007
+++ php-src/ext/pdo/pdo_stmt.c  Tue Jun 26 01:24:10 2007
@@ -18,7 +18,7 @@
   +----------------------------------------------------------------------+
 */
 
-/* $Id: pdo_stmt.c,v 1.118.2.38.2.18 2007/05/16 20:04:32 tony2001 Exp $ */
+/* $Id: pdo_stmt.c,v 1.118.2.38.2.19 2007/06/26 01:24:10 iliaa Exp $ */
 
 /* The PDO Statement Handle Class */
 
@@ -280,7 +280,13 @@
        }
 
        if (PDO_PARAM_TYPE(param->param_type) == PDO_PARAM_STR && 
param->max_value_len <= 0 && ! ZVAL_IS_NULL(param->parameter)) {
-               convert_to_string(param->parameter);
+               if (Z_TYPE_P(param->parameter) == IS_DOUBLE) {
+                       char *p;
+                       int len = spprintf(&p, 0, "%F", 
Z_DVAL_P(param->parameter));
+                       ZVAL_STRINGL(param->parameter, p, len, 0);
+               } else {
+                       convert_to_string(param->parameter);
+               }
        } else if (PDO_PARAM_TYPE(param->param_type) == PDO_PARAM_INT && 
Z_TYPE_P(param->parameter) == IS_BOOL) {
                convert_to_long(param->parameter);
        } else if (PDO_PARAM_TYPE(param->param_type) == PDO_PARAM_BOOL && 
Z_TYPE_P(param->parameter) == IS_LONG) {

http://cvs.php.net/viewvc.cgi/php-src/ext/pdo_mysql/tests/bug_41698.phpt?view=markup&rev=1.1
Index: php-src/ext/pdo_mysql/tests/bug_41698.phpt
+++ php-src/ext/pdo_mysql/tests/bug_41698.phpt

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

Reply via email to