#43139 [Opn->Csd]: PDO ignore ATTR_DEFAULT_FETCH_MODE in some cases

From: Date: Wed, 31 Oct 2007 12:58:46 +0000
Subject: #43139 [Opn->Csd]: PDO ignore ATTR_DEFAULT_FETCH_MODE in some cases
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-119145@lists.php.net to get a copy of this message
ID: 43139 Updated by: iliaa@php.net Reported By: develar at gmail dot com -Status: Open +Status: Closed Bug Type: PDO related Operating System: Windows XP SP2 PHP Version: 5.2.4 New Comment: This bug has been fixed in CVS. Snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. Thank you for the report, and for helping us make PHP better. Previous Comments: ------------------------------------------------------------------------ [2007-10-30 14:29:00] stochnagara at hotmail dot com I have a similar problem with 5.2.4 on a linux/mysql installation. The things worked on 5.2.0. The only difference is that I have a class that overrides PDOStatement and there I use $this->setFetchMode (PDO::FETCH_OBJ) which is not taken into account if FETCH_OBJ is not explicitly set in further fetch/fetchAll calls. ------------------------------------------------------------------------ [2007-10-30 11:49:32] develar at gmail dot com Description: ------------ In 5.2.4 (earlier all worked) and 5.2.5RC2dev (I now use this version) PDO ignore ATTR_DEFAULT_FETCH_MODE. PostgreSQL 8.2.4 and 8.3beta1. Reproduce code: --------------- <?php $Db = new PDO('pgsql:host=localhost;dbname=test', 'postgres', 'password'); $Db->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC); $Db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING); print_r($Db->query('select 0 as name, 1 as table, 2 as schema')->fetchAll(PDO::FETCH_GROUP)); ?> Expected result: ---------------- Array ( [0] => Array ( [0] => Array ( [table] => 1 [schema] => 2 ) ) ) Actual result: -------------- Array ( [0] => Array ( [0] => Array ( [table] => 1 [0] => 1 [schema] => 2 [1] => 2 ) ) ) ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=43139&edit=1

« previous php.bugs (#119145) next »