|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2009-03-22 19:57 UTC] matteo at beccati dot com
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Dec 20 16:00:02 2025 UTC |
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"