Bug #61101 [Com]: Fetch Class does not set the column name
Edit report at https://bugs.php.net/bug.php?id=61101&edit=1
ID: 61101
Comment by: anilvarghese25 at gmail dot com
Reported by: anilvarghese25 at gmail dot com
Summary: Fetch Class does not set the column name
Status: Feedback
Type: Bug
Package: PDO related
Operating System: Linux
PHP Version: 5.3.10
Block user comment: N
Private report: N
New Comment:
Have to also add, SQLDescribeParameter call seems to fail for me. Could this be
the reason the namelen is not set?
Previous Comments:
------------------------------------------------------------------------
[2012-03-14 20:14:26] anilvarghese25 at gmail dot com
I was using 5.3.10. Might be a new bug?
My patch fixed the issue and its being used in our production environment now.
------------------------------------------------------------------------
[2012-03-14 20:11:15] iliaa@php.net
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
------------------------------------------------------------------------
[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
Thread (7 messages)