From: ilpochta at gmail dot com Operating system: All PHP version: 5.2.0 PHP Bug Type: InterBase related Bug description: NUMERIC error when result precision are 7,8 or 12-14
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 bug report at http://bugs.php.net/?id=39700&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=39700&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=39700&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=39700&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=39700&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=39700&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=39700&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=39700&r=needscript Try newer version: http://bugs.php.net/fix.php?id=39700&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=39700&r=support Expected behavior: http://bugs.php.net/fix.php?id=39700&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=39700&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=39700&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=39700&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=39700&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=39700&r=dst IIS Stability: http://bugs.php.net/fix.php?id=39700&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=39700&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=39700&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=39700&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=39700&r=mysqlcfg