ID: 39700
Updated by: [EMAIL PROTECTED]
Reported By: ilpochta at gmail dot com
-Status: Open
+Status: Feedback
Bug Type: InterBase related
Operating System: All
PHP Version: 5.2.0
New Comment:
You can try to change the lines mentioned in #39056 (see
ext/interbase/ibase_query.c) and tell us if it works.
I don't think anybody here uses Interbase these days.
Previous Comments:
------------------------------------------------------------------------
[2006-12-01 11:00:18] ilpochta at gmail dot com
Description:
------------
When SQL query returns numbers with precision 7, 8 or 12-14 (digits
after period) ibase_fetch_*() returns these numbers divided by 10.
When precision are 18 - returns "29".
I was tested this on PHP 5.2, 5.1.6; on WinXP and RedHat Linux; on
Firebird 1.5 and 2.
Maybe, this is some bug with #39056 ?
Reproduce code:
---------------
//generate SQL
$nums=array();
for($i=0;$i<=18;$i++) {
$nums[]=sprintf('1.%s AS prc_%d', str_repeat('0',$i), $i);
}
$stmt='SELECT '. implode(', ',$nums). ' FROM RDB$DATABASE';
//query
$dbh = ibase_connect('localhost:c:/main.gdb', 'SYSDBA', 'masterkey');
$sth = ibase_query($dbh, $stmt) or die(ibase_errmsg());
$res=ibase_fetch_assoc($sth);
print_r($res);
Expected result:
----------------
PHP 4 outputs:
Array
(
[PRC_0] => 1
[PRC_1] => 1.0
[PRC_2] => 1.00
[PRC_3] => 1.000
[PRC_4] => 1.0000
[PRC_5] => 1.00000
[PRC_6] => 1.000000
[PRC_7] => 1.0000000
[PRC_8] => 1.00000000
[PRC_9] => 1.000000000
[PRC_10] => 1.0000000000
[PRC_11] => 1.00000000000
[PRC_12] => 1.000000000000
[PRC_13] => 1.0000000000000
[PRC_14] => 1.00000000000000
[PRC_15] => 1.000000000000000
[PRC_16] => 1.0000000000000000
[PRC_17] => 1.00000000000000000
[PRC_18] => 1.000000000000000000
)
Actual result:
--------------
Array
(
[PRC_0] => 1
[PRC_1] => 1.0
[PRC_2] => 1.00
[PRC_3] => 1.000
[PRC_4] => 1.0000
[PRC_5] => 1.00000
[PRC_6] => 1.000000
[PRC_7] => 0.10000000
[PRC_8] => 0.100000000
[PRC_9] => 1.000000000
[PRC_10] => 1.0000000000
[PRC_11] => 1.00000000000
[PRC_12] => 0.1000000000000
[PRC_13] => 0.10000000000000
[PRC_14] => 0.100000000000000
[PRC_15] => 1.000000000000000
[PRC_16] => 0.10000000000000000
[PRC_17] => 0.100000000000000000
[PRC_18] => 29.008656684181574799
)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=39700&edit=1