|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2020-04-09 02:17 UTC] michaelobe at mjws dot net
[2020-04-09 07:01 UTC] cmb@php.net
-Status: Open
+Status: Feedback
-Assigned To:
+Assigned To: cmb
[2020-04-09 07:01 UTC] cmb@php.net
[2020-04-19 04:22 UTC] php-bugs at lists dot php dot net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Nov 02 13:00:01 2025 UTC |
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!