From:             vberko at mail dot com
Operating system: Windows
PHP version:      5.4.11
Package:          PDO related
Bug Type:         Bug
Bug description:Firebird return wrong value for numeric field

Description:
------------
When i store -1 value in a numeric field and i read back, i get -0.00


Test script:
---------------
SET SQL DIALECT 3;
SET NAMES WIN1250;
CREATE DATABASE '127.0.0.1/gds_db:C:\TEST\test2.fdb' USER 'test' PASSWORD
'test' PAGE_SIZE = 4096 DEFAULT CHARACTER SET WIN1250;
CREATE TABLE PRICE (ID INTEGER NOT NULL, TEXT VARCHAR(10), COST NUMERIC(15,
2));
INSERT INTO PRICE (ID, TEXT, COST) VALUES (2, 'test', -1);

$db=new
PDO("firebird:dbname=localhost:c:/TEST/test2.fdb","test","test",array());
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);                   
$sql="select id,cost from price where id=2";
$q=$db->query($sql);
$ret=$q->fetchAll();
var_dump($ret);

result:
array(1) { [0]=> array(4) { ["ID"]=> string(1) "2" [0]=> string(1) "2"
["COST"]=> string(5) "-0.00" [1]=> string(5) "-0.00" } } 

Expected result:
----------------
I get back -0.00 but the right result is -1.


-- 
Edit bug report at https://bugs.php.net/bug.php?id=64037&edit=1
-- 
Try a snapshot (PHP 5.4):   
https://bugs.php.net/fix.php?id=64037&r=trysnapshot54
Try a snapshot (PHP 5.3):   
https://bugs.php.net/fix.php?id=64037&r=trysnapshot53
Try a snapshot (trunk):     
https://bugs.php.net/fix.php?id=64037&r=trysnapshottrunk
Fixed in SVN:               https://bugs.php.net/fix.php?id=64037&r=fixed
Fixed in release:           https://bugs.php.net/fix.php?id=64037&r=alreadyfixed
Need backtrace:             https://bugs.php.net/fix.php?id=64037&r=needtrace
Need Reproduce Script:      https://bugs.php.net/fix.php?id=64037&r=needscript
Try newer version:          https://bugs.php.net/fix.php?id=64037&r=oldversion
Not developer issue:        https://bugs.php.net/fix.php?id=64037&r=support
Expected behavior:          https://bugs.php.net/fix.php?id=64037&r=notwrong
Not enough info:            
https://bugs.php.net/fix.php?id=64037&r=notenoughinfo
Submitted twice:            
https://bugs.php.net/fix.php?id=64037&r=submittedtwice
register_globals:           https://bugs.php.net/fix.php?id=64037&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=64037&r=php4
Daylight Savings:           https://bugs.php.net/fix.php?id=64037&r=dst
IIS Stability:              https://bugs.php.net/fix.php?id=64037&r=isapi
Install GNU Sed:            https://bugs.php.net/fix.php?id=64037&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=64037&r=float
No Zend Extensions:         https://bugs.php.net/fix.php?id=64037&r=nozend
MySQL Configuration Error:  https://bugs.php.net/fix.php?id=64037&r=mysqlcfg

Reply via email to