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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
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

Pull Requests

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-2025 The PHP Group
All rights reserved.
Last updated: Thu Jul 03 20:01:34 2025 UTC