Bug #79461 [Fbk->NoF]: Incorrect number returned for NUMERIC type field in php 7.3
| From: | php-bugs at lists dot php dot net | Date: | Sun, 19 Apr 2020 04:22:04 +0000 |
| Subject: | Bug #79461 [Fbk->NoF]: Incorrect number returned for NUMERIC type field in php 7.3 | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-226664@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=79461&edit=1
ID: 79461
Updated by: php-bugs@lists.php.net
Reported by: michaelobe at mjws dot net
Summary: Incorrect number returned for NUMERIC type field in
php 7.3
-Status: Feedback
+Status: No Feedback
Type: Bug
Package: PDO Firebird
Operating System: FreeBSD 12.1
PHP Version: 7.3.16
Assigned To: cmb
Private report: N
New Comment:
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.
Previous Comments:
------------------------------------------------------------------------
[2020-04-09 07:01:16] cmb@php.net
I cannot reproduce the reported behavior with a Firebird 3.0.4
database on Windows using PHP 7.3. Can you please provide a fully
self-contained minimal reproduce script?
------------------------------------------------------------------------
[2020-04-09 02:17:03] michaelobe at mjws dot net
This bug does not appear to be present in php 7.4.4.
I plan on switching to php 7.4 but it would be nice if both PDO firebird and ibase_* were working
for me in 7.3 so I could transition.
I totally understand if this cannot be backported for some reason.
------------------------------------------------------------------------
[2020-04-08 23:11:46] michaelobe at mjws dot net
Description:
------------
I am attempting to change from the built in Firebird ibase_ functions to PDO Firebird.
The Firebird version I am using is 2.5. php is 7.3.
Without modifying a query between both drivers, I got a totally different number back.
The query is simple:
select
INVC_NUMBER,
invc_header.total_price
from
invc_header where invc_number = 'invc1';
The number in this case should be 3330.0000 and this works in ibase_.
But the number I get back is using PDO is 3459935.8848. It is obviously quite different. When I try
to get another numeric that is 2664.0000 in the database, PDO again returns 3459935.8848
When investigating further I realized that NUMERIC type fields return the wrong number.
If I cast the field as something else it works:
select
INVC_NUMBER,
cast(invc_header.total_price as float) TOTAL_PRICE
from
invc_header where invc_number = 'invc1';
The data type for the total_price field is:
NUMERIC(15, 4) Nullable
One other weird thing: if I cast it as the same type it also returns the correct number.
cast(invc_header.total_price as numeric(15,4)) TOTAL_PRICE
yields 3330 but
invc_header.total_price TOTAL_PRICE
yields 3460355.6864
I saw this from years ago which seems to be the same issue.
https://stackoverflow.com/questions/39245467/php-pdo-firebird-select-sum-return-wrong-result
I can confirm the issue exists for me when using the sum on the numeric type.
Thank you!
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=79461&edit=1