php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #71652 Wrong float values will be returned
Submitted: 2016-02-23 15:41 UTC Modified: 2019-10-28 15:37 UTC
Votes:4
Avg. Score:4.5 ± 0.9
Reproduced:2 of 2 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: b dot vonheesen at maprom dot de Assigned: cmb (profile)
Status: Duplicate Package: PDO Firebird
PHP Version: 7.0.3 OS: Ubuntu 14.04 LTS 64-Bit
Private report: No CVE-ID: None
 [2016-02-23 15:41 UTC] 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
]

Patches

CannotSeeFormerlyUploadedPatch_HereAgain (last revision 2016-02-24 08:31 UTC by b dot vonheesen at maprom dot de)

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-03-03 13:45 UTC] cmb@php.net
This appears to be a duplicate of bug #65690.
 [2016-03-22 14:56 UTC] chris dot spb25 at gmail dot com
I also am with this same problem.
I'm using php 7.0.4 nts 32bit on windows platform.
 [2016-03-22 15:07 UTC] chris dot spb25 at gmail dot com
result of my query:

See the attribute values:
PEDVRTOTAL
PEDVRDESCTO
PEDVRDESCTOSER
TOTAL FINAL

[0] => stdClass Object
        (
            [ID_PEDIDO] => 218488
            [PEDDTEMIS] => 2015-12-01 00:00:00
            [PEDCODIGO] => 206265.001
            [PEDVRTOTAL] => 2065761874.56
            [PEDVRDESCTO] => 3096554025.60
            [PEDVRDESCTOSER] => 4127346176.64
            [EMPCODIGO] => 1
            [EMPRAZSOCIAL] => WINNIKES IND. E COM. DE OCULOS LTDA 
            [PEDDTSAIDA] => 
            [PEDORDEMCOMPRA] => 
            [TOTAL_FINAL] => 10312099082.88
            [NFCODIGO] => 000002.3  
            [NFDTEMIS] => 2015-12-01 00:00:00
        )
 [2016-03-22 15:22 UTC] chris dot spb25 at gmail dot com
these fields are numeric (15,2)
		
Expected result:

stdClass Object
(
    [PEDVRTOTAL] => 32.5
    [PEDVRDESCTO] => 0
    [PEDVRDESCTOSER] => 0
    [TOTAL_FINAL] => 32.5
)

Actual result:
stdClass Object
(
	[PEDVRTOTAL] => 2065761874.56
	[PEDVRDESCTO] => 3096554025.60
	[PEDVRDESCTOSER] => 4127346176.64
	[TOTAL_FINAL] => 10312099082.88
)
 [2016-05-29 16:41 UTC] ab@php.net
-Status: Open +Status: Feedback
 [2016-05-29 16:41 UTC] ab@php.net
Currently i don't reproduce this issue with Firebird 2.5.5. Doing "SET SQL DIALECT 1" before your snippet, but the behavior is correct. Could you please provide a bit more precise reproduce way?

Also, probably *100 is not what one wants to have, fe if the column definition were NUMERIC(15,3). 

Thanks.
 [2016-06-12 04:22 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
 [2019-10-28 15:37 UTC] cmb@php.net
-Status: No Feedback +Status: Duplicate -Assigned To: +Assigned To: cmb
 [2019-10-28 15:37 UTC] cmb@php.net
Actually, this is a duplicate of bug #65690.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 12:01:29 2024 UTC