|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #38252 Incorrect PDO error message
Submitted: 2006-07-29 18:06 UTC Modified: 2006-12-04 02:40 UTC
From: stochnagara at hotmail dot com Assigned:
Status: Closed Package: PDO related
PHP Version: 5.2.0RC1 OS: windows xp
Private report: No CVE-ID: None
 [2006-07-29 18:06 UTC] stochnagara at hotmail dot com
PDO gives an inconsisten error message when I use the new PDO::ATTR_DEFAULT_FETCH_MODE in combination with PDO::FETCH_INTO.

Reproduce code:

$pdo = new PDO ('sqlite::memory:');

$pdo->exec ("create table test (id integer primary key, n text)");
$pdo->exec ("INSERT INTO test (n) VALUES ('hi')");

$pdo->setAttribute (PDO::ATTR_DEFAULT_FETCH_MODE, array (PDO::FETCH_INTO, $a));
$stmt = $pdo->prepare ("SELECT * FROM test");

Expected result:
i don't know exactly

Actual result:
Warning: PDOStatement::fetchAll() [function.PDOStatement-fetchAll]: SQLSTATE[HY000]: General error: PDO::FETCH_LAZY can't be used with PDOStatement::fetchAll() in ... on line 11


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2006-07-29 18:14 UTC] stochnagara at hotmail dot com
I get the same error when I use this:

$pdo->setAttribute (PDO::ATTR_DEFAULT_FETCH_MODE, array (PDO::FETCH_CLASS, 'SimpleXMLElement'));
 [2006-07-29 18:23 UTC]
FETCH_INTO and FETCH_CLASS are not yet supported as default fetch mode. I will update the code to report the correct error.
 [2006-12-04 02:40 UTC]
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
Thank you for the report, and for helping us make PHP better.

PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Tue Jun 06 23:03:36 2023 UTC