Edit report at http://bugs.php.net/bug.php?id=53394&edit=1
ID: 53394 Updated by: fel...@php.net Reported by: public at grik dot net Summary: ARRAY_AS_PROPS flag is ignored when used with PDOStatement::fetchObject -Status: Bogus +Status: To be documented Type: Bug Package: SPL related PHP Version: 5.3.3 -Assigned To: felipe +Assigned To: Block user comment: N Private report: N New Comment: Right, it needs be documented. Previous Comments: ------------------------------------------------------------------------ [2010-11-24 23:32:49] public at grik dot net It's not bogus. It is a documentation issue at least. I guess, it needs to be described somewhere beyond the bugtracker. all I see in docs is: PDO::FETCH_PROPS_LATE ( integer ) Available since PHP 5.2.0 ------------------------------------------------------------------------ [2010-11-24 22:16:34] fel...@php.net Hi, there was a discussion about this, see bug #49521 You could do something like this: $a = $PDO->query('select id from links'); $a->setFetchMode(PDO::FETCH_CLASS|PDO::FETCH_PROPS_LATE, 'ArraySlice'); $a = $a->fetch(); var_dump($a->id, $a['id']); Thanks. ------------------------------------------------------------------------ [2010-11-24 15:27:19] tony2...@php.net Felipe, could you check this out plz? ------------------------------------------------------------------------ [2010-11-24 15:25:58] tony2...@php.net Please try using this snapshot: http://snaps.php.net/php5.3-latest.tar.gz For Windows: http://windows.php.net/snapshots/ ------------------------------------------------------------------------ [2010-11-24 13:54:20] crocodile2u at gmail dot com Or possibly it would be better to change the PDO's behaviour? It seems very strange and unnatural that constructor is called after the properties are set. It only makes developers write unobvious code for the only purpose of workaround for this PDO's feature (personally, I would consider it a bug). ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/bug.php?id=53394 -- Edit this bug report at http://bugs.php.net/bug.php?id=53394&edit=1