php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #43139 PDO ignore ATTR_DEFAULT_FETCH_MODE in some cases
Submitted: 2007-10-30 11:49 UTC Modified: 2007-10-31 12:58 UTC
From: develar at gmail dot com Assigned:
Status: Closed Package: PDO related
PHP Version: 5.2.4 OS: Windows XP SP2
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: develar at gmail dot com
New email:
PHP Version: OS:

 

 [2007-10-30 11:49 UTC] 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
                )

        )

)

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-10-30 14:29 UTC] 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-31 12:58 UTC] iliaa@php.net
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.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Oct 14 17:01:28 2024 UTC