Edit report at http://bugs.php.net/bug.php?id=48855&edit=1

 ID:               48855
 Comment by:       r dot wilczek at web-appz dot de
 Reported by:      lorenzo-99 at libero dot it
 Summary:          Decimals are rounded with PDO bindValue in mysql
                   double/float fields
 Status:           Closed
 Type:             Bug
 Package:          PDO related
 Operating System: Windows XP
 PHP Version:      5.2.10

 New Comment:

This bug persists in current PHP 5.3.2 with MySQL 5.1.36 and MySQL
client API version 5.0.67 (64 bit Linux)


Previous Comments:
------------------------------------------------------------------------
[2009-09-25 15:06:18] lorenzo-99 at libero dot it

Ok in this last version (5.3.2dev) the problem is really fixed.

So I consider the problem closed

thank you very much

------------------------------------------------------------------------
[2009-09-25 14:13:14] u...@php.net

Please try using this snapshot:

  http://snaps.php.net/php5.3-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/



------------------------------------------------------------------------
[2009-09-25 13:58:37] lorenzo-99 at libero dot it

Sorry but The Problem in 5.3 is NOT fixed.



I tried first to install 5.2.11 and i verified that the problem is
fixed, then I update to 5.3 but the problem here still exists



I download the windows version from http://windows.php.net/download/



php-5.3.0-Win32-VC6-x86.zip thread-safe



The strange thing I see is that 5.3 is dated 2009-jun-30 while 5.2.11 is
more recent 2009-sep-17

------------------------------------------------------------------------
[2009-09-23 10:32:05] u...@php.net

Thank you for your bug report. This issue has already been fixed
in the latest released version of PHP, which you can download at 
http://www.php.net/downloads.php

Hmm, seems to have been fixed before in SVN and in PHP 5.2.11:



        if (PDO_PARAM_TYPE(param->param_type) == PDO_PARAM_STR &&
param->max_value_len <= 0 && ! ZVAL_IS_NULL(param->parameter)) {

                if (Z_TYPE_P(param->parameter) == IS_DOUBLE) {

                        char *p;

                        int len = spprintf(&p, 0, "%.*H", (int)
EG(precision), Z_DVAL_P(param->parameter));

                        ZVAL_STRINGL(param->parameter, p, len, 0);

                } else {

                        convert_to_string(param->parameter);

                }



------------------------------------------------------------------------
[2009-09-22 16:51:45] u...@php.net

That is a PDO bug not a PDO_MYSQL bug. It has been fixed in PHP 5.3+.



ext/pdo/pdo_stmt.c:330 needs something like this:



int len = spprintf(&p, 0, "%.*H", (int) EG(precision),
Z_DVAL_P(param->parameter));



I don't know what the policy is with PHP 5.2. Would be nice if someone
else could apply the patch. I am quite sure to have seen this bug before
and I am also sure the 5.3 tests cover it. Though, I can't say which
test from top of my head. 

------------------------------------------------------------------------


The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

    http://bugs.php.net/bug.php?id=48855


-- 
Edit this bug report at http://bugs.php.net/bug.php?id=48855&edit=1

Reply via email to