#47749 [Opn->Bgs]: PDO::FETCH_COLUMN only accepts a 0-indexed parameter
| From: | matteo at beccati dot com | Date: | Sun, 22 Mar 2009 19:57:15 +0000 |
| Subject: | #47749 [Opn->Bgs]: PDO::FETCH_COLUMN only accepts a 0-indexed parameter | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-2025@lists.php.net to get a copy of this message | ||
ID: 47749
User updated by: matteo at beccati dot com
Reported By: matteo at beccati dot com
-Status: Open
+Status: Bogus
Bug Type: Documentation problem
Operating System: *
PHP Version: Irrelevant
New Comment:
I was checking the wrong manual page while reviewing #44173. Sorry for
the noise.
Previous Comments:
------------------------------------------------------------------------
[2009-03-22 19:45:53] matteo at beccati dot com
Description:
------------
The documentation mentions that PDO::FETCH_COLUMN accepts either a
1-indexed integer or the column name as string. While fixing #44173 I've
noticed that both hints are wrong. On PHP 5.3 any string is casted to
int (therefore becoming 0) and the parameter is in fact supposed to be
0-indexed.
Note: the proposed fix for #44713 enforces the colno parameter to be
integer.
A documentation patch will be available shortly.
Reproduce code:
---------------
var_dump($db->query("SELECT 1 as a, 2 as b", PDO::FETCH_COLUMN,
'b')->fetch());
Expected result:
----------------
string(1) "2"
Actual result:
--------------
string(1) "1"
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=47749&edit=1