Bug #71652 [Com]: Wrong float values will be returned

From: Date: Tue, 22 Mar 2016 14:56:42 +0000
Subject: Bug #71652 [Com]: Wrong float values will be returned
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-200036@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=71652&edit=1

 ID:                 71652
 Comment by:         chris dot spb25 at gmail dot com
 Reported by:        b dot vonheesen at maprom dot de
 Summary:            Wrong float values will be returned
 Status:             Open
 Type:               Bug
 Package:            PDO Firebird
 Operating System:   Ubuntu 14.04 LTS 64-Bit
 PHP Version:        7.0.3
 Block user comment: N
 Private report:     N

 New Comment:

I also am with this same problem.
I'm using php 7.0.4 nts 32bit on windows platform.


Previous Comments:
------------------------------------------------------------------------
[2016-03-03 13:45:30] cmb@php.net

This appears to be a duplicate of bug #65690.

------------------------------------------------------------------------
[2016-02-23 15:41:42] b dot vonheesen at maprom dot de

Description:
------------
Starting position:
Ubuntu 14.04 LTS 64-Bit, PHP 7.0.3
Interbase with dialect 1

All columns of type NUMERIC return wrong values.
The returned value is the ordinal position multiplied with 0.4 instead of the correct value.

Sorry, I don't know how to use git diff so I created a diff with 

diff -Naur firebird_statement.c firebird_statement.new > patch.c



Test script:
---------------
$pdo = new PDO('firebird:...');

$pdo->query('CREATE TABLE test (id INTEGER, name VARCHAR(20), price NUMERIC(15,2), price2
NUMERIC(15,2))');

$pdo->query('INSERT INTO test(id, name, price, price2) VALUES(1, 'Test1', 6.45,
7.25)');
$pdo->query('SELECT id, name, price FROM test');

$result = $pdo->fetchAll();


Expected result:
----------------
$result = [
[
    'id' => 1,         // column 0
    'name' => 'Test1', // column 1
    'price' => 6.45,   // column 2
    'price2' => 7.25   // column 3
]

Actual result:
--------------
$result = [
    'id' => 1,         // column 0
    'name' => 'Test1', // column 1
    'price' => 0.8,    // column 2: 0.4 * 2
    'price2' => 1.2    // column 3: 0.4 * 3
]


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



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


Thread (8 messages)

« previous php.bugs (#200036) next »