php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #59788 selecting from a float column returns wrong value
Submitted: 2011-05-26 17:42 UTC Modified: 2011-05-27 16:37 UTC
From: jon at millerind dot com Assigned:
Status: Open Package: PDO_INFORMIX (PECL)
PHP Version: 5.3.3 OS: OpenSUSE 11.3, CentOS 5.6
Private report: No CVE-ID: None
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
25 - 5 = ?
Subscribe to this entry?

 
 [2011-05-26 17:42 UTC] jon at millerind dot com
Description:
------------
When I select a float column in an SQL query, the value returned has the decimal point moved one place to the right.
123.5000 would be returned as 1235.000. This seems to happen for any value that has a non-zero digit to the right of the decimal point, so 123.000 would be returned properly.

PHP 5.3.3, PHP 5.3.6
PDO_INFORMIX 1.2.6
(not sure if unixODBC is used, but I was thinking I read that it was)
unixODBC-2.2.12-203.1.x86_64 
unixODBC-devel-2.2.12-203.1.x86_64
unixODBC-gui-qt-2.2.12-203.2.x86_64
Informix CSDK 3.50 FC5

./configure  --with-apxs2=/usr/local/apache2/bin/apxs --with-pic --disable-rpath --with-bz2 --with-curl --with-mhash --with-mcrypt --enable-gd-native-ttf --without-gdbm --with-gd --with-gettext --with-pear --with-gmp --with-iconv --with-openssl --with-png-dir=/usr/lib64 --with-pspell --with-zlib --with-zlib-dir=/usr/lib --with-jpeg-dir=/usr/lib64 --enable-exif --with-freetype-dir=/usr/lib --enable-ftp --enable-magic-quotes --enable-sockets --enable-sysvsem --enable-sysvshm --enable-sysvmsg --enable-wddx --with-kerberos --enable-ucd-snmp-hack --with-unixODBC=/usr --enable-shmop --enable-calendar --with-sqlite=shared --enable-pcntl --with-imap=shared --with-imap-ssl --enable-mbstring=shared --enable-mbregex --with-gd=shared --enable-bcmath=shared --enable-dba=shared --with-db4 --with-xmlrpc=shared --with-ldap=shared --with-ldap-sasl --with-mysql --with-mysqli=/usr/bin/mysql_config --with-libdir=lib64 --enable-dom=shared --with-pgsql=shared --with-snmp=shared --enable-soap=shared --with-xsl=shared --enable-xmlreader=shared --enable-xmlwriter=shared --enable-pdo=shared --with-pdo-odbc=shared,unixODBC,/usr --with-pdo-mysql=shared --with-pdo-pgsql=shared --with-pdo-sqlite=shared

Reproduce code:
---------------
$sql = "select my_float_col from my_test_table";
$res = $ifxpdo->query($sql);
$row = $res->fetch(PDO::FETCH_OBJ);
print_r($row);


Expected result:
----------------
With a test value of 123.500, I expect to see the result of 123.500.

Actual result:
--------------
The actual result would be 1235.00.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-05-26 17:43 UTC] jon at millerind dot com
Informix server version is 11.50 FC7
 [2011-05-27 09:04 UTC] jon at millerind dot com
the old ext_informix extension returns the correct result, isql provided by unixODBC returns the correct result, using PDO on the same setup to connect to MySQL also returns the same result, just not PDO_INFORMIX - trying to set up on Windows for testing as well...
 [2011-05-27 16:37 UTC] jon at millerind dot com
tested on a vm with opensuse 11.3 and PHP 5.3.3 rpm packages, using pecl install --alldeps PDO_INFORMIX and the proper data is returned
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 08 05:01:28 2024 UTC