Edit report at https://bugs.php.net/bug.php?id=61939&edit=1
ID: 61939 Comment by: mar...@php.net Reported by: sim-mail at list dot ru Summary: PDO_FIREBIRD incorrect result of query for NUMERIC(x, y) type in 1 dialect Status: Open Type: Bug Package: PDO related Operating System: Windows 7 32bit PHP Version: 5.3.12 Block user comment: N Private report: N New Comment: Currently it is possible to create databases in Dialect 1 and 3 only, however it is recommended that you use Dialect 3 exclusively, since Dialect 1 will eventually be deprecated. Previous Comments: ------------------------------------------------------------------------ [2012-06-26 15:50:14] manubing at gmail dot com Also affected on macosx using PHP 5.3.10 and debian lenny with PHP 5.2.6-1+lenny16. Something odd: incorrect results are the same for a column for all rows fetched: using the previous example: public 'COST' => string '1.00' <-- Error All rows fetched will have 'COST' set to '1.00' (even if actual values differs) Running again the query will give another (eg: '600.000000') incorrect value, the same on all rows again. ------------------------------------------------------------------------ [2012-05-04 14:53:01] sim-mail at list dot ru only 1 dialect ------------------------------------------------------------------------ [2012-05-04 14:50:22] sim-mail at list dot ru Description: ------------ PDO_FIREBIRD incorrect result of query for NUMERIC(x, y) or DECIMAL (x, y) type <?php $sql = 'select * from price'; $dbh = new PDO('firebird:dbname=localhost:d:\interbasedata\test.fdb;charset=win1251', 'sysdba', 'masterkey'); $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $sth = $dbh->prepare($sql); $sth->execute(); $obj = $sth->fetch(); var_dump($obj); $sth = null; ?> Script print object(stdClass)[3] public 'ID' => string '1' (length=1) public 'NAME' => string 'my price' (length=8) public 'COST' => string '1.00' (length=4) <-- Error hear (correct result 12.34) Test script: --------------- Sql script for create database SET SQL DIALECT 1; SET NAMES WIN1251; CREATE DATABASE 'LOCALHOST:D:\interbasedata\test.fdb' USER 'SYSDBA' PASSWORD 'masterkey' PAGE_SIZE 16384 DEFAULT CHARACTER SET WIN1251 COLLATION WIN1251; CREATE TABLE PRICE ( ID INTEGER NOT NULL, NAME VARCHAR(10), COST NUMERIC(15,2) ); INSERT INTO PRICE (ID, NAME, COST) VALUES (1, 'my price', 12.34); COMMIT WORK; ALTER TABLE PRICE ADD CONSTRAINT PK_PRICE PRIMARY KEY (ID); ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=61939&edit=1