Edit report at https://bugs.php.net/bug.php?id=61101&edit=1

 ID:                 61101
 Updated by:         il...@php.net
 Reported by:        anilvarghese25 at gmail dot com
 Summary:            Fetch Class does not set the column name
-Status:             Open
+Status:             Feedback
 Type:               Bug
 Package:            PDO related
 Operating System:   Linux
 PHP Version:        5.3.10
 Block user comment: N
 Private report:     N

 New Comment:

Please try using this snapshot:

  http://snaps.php.net/php5.3-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/

Cannot reproduce the issue even with PHP 5.3.8


Previous Comments:
------------------------------------------------------------------------
[2012-02-16 04:42:58] anilvarghese25 at gmail dot com

Description:
------------
PDOStatement::Fetch using PDO::FETCH_CLASS does not set the attribute name. The 
class set function is called with an empty var name but correct variable value.

Test script:
---------------
$connection = new PDO($dsn, $user, $password);
$sql = 'select 1 as columnname from table where 1 = :value';
$stmt = $connection->prepare($sql);
$stmt->bindValue(':value', 1);
$result = $stmt->execute();
$class = $stmt->fetchAll(PDO::FETCH_CLASS, 'Test');

Expected result:
----------------
Will get an array of class Test with property '' and value 1.



Actual result:
--------------
Expect to see column name as 'columnname'


------------------------------------------------------------------------



-- 
Edit this bug report at https://bugs.php.net/bug.php?id=61101&edit=1

Reply via email to