php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #42881 PDO::FETCH_CLASS incorrectly returns PDO::FETCH_BOTH
Submitted: 2007-10-07 07:10 UTC Modified: 2007-12-10 03:47 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: voidalan at koitech dot net Assigned:
Status: Closed Package: PDO related
PHP Version: 5.2.4 OS: CentOS 5
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: voidalan at koitech dot net
New email:
PHP Version: OS:

 

 [2007-10-07 07:10 UTC] voidalan at koitech dot net
Description:
------------
When using PDO::FETCH_CLASS it incorrectly returns PDO::FETCH_BOTH. In other words instead of returning objects it is returning a mixed array.

The below code worked in 5.2.3 but when upgrading to 5.2.4 this occured.

Reproduce code:
---------------
http://pastemonkey.org/paste/470883a5-8d1c-4256-a59d-27b2404fdb0d

Expected result:
----------------
Array(
  [0] => Object(
    id =>
    hidden =>
    featured =>
    title =>
    clientName =>
    teaser =>
    content =>
    imgUrl =>
    publishedBy =>
    dateCreated =>
    dateModified =>
  )
 ...
)

Actual result:
--------------
Array
(
    [0] => Array
        (
            [id] => 
            [0] => 
            [hidden] => 
            [1] => 
            [featured] => 
            [2] =>
            [title] => 
            [3] => 
            [clientName] => 
            [4] => 
            [teaser] => 
            [5] => 
            [content] =>  
            [6] => 
            [imgUrl] => 
            [7] => 
            [publishedBy] => 
            [8] => 
            [dateCreated] => 
            [9] => 
            [dateModified] => 
            [10] => 
        )
  ...
)

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-10-12 18:19 UTC] mj@php.net
The problem seems to be related to the usage of PDO::FETCH_PROPS_LATE and I can reproduce it with PHP 5.3.  Seems to work with HEAD, however.

 [2007-12-10 03:47 UTC] voidalan at koitech dot net
Duplicate(http://bugs.php.net/43139). Fixed in 5.2.5
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun May 05 07:01:32 2024 UTC