php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #36428 Incorrect error message for PDO::fetchAll
Submitted: 2006-02-17 16:35 UTC Modified: 2006-02-24 17:05 UTC
From: stochnagara at hotmail dot com Assigned: helly (profile)
Status: Closed Package: SimpleXML related
PHP Version: 5.1.* OS: *
Private report: No CVE-ID: None
 [2006-02-17 16:35 UTC] stochnagara at hotmail dot com
Description:
------------
Trying to fetch DB result into a SimpleXMLElement instance produces an incorrect error message.

Reproduce code:
---------------
$q = new PDO('sqlite::memory:');
$q->exec ("CREATE TABLE test (a)");
$q->exec ("INSERT INTO test (a) VALUES (1)");
var_dump ($q->query ("SELECT a FROM test")->fetchAll(PDO::FETCH_CLASS, 'SimpleXMLElement', array ('<root/>')));


Expected result:
----------------
Some consistent error message.

Actual result:
--------------

Warning:  PDOStatement::fetchAll() [function.fetchAll]: Node no longer exists in c:\program files\apache group\Apache\htdocs\standart\index.php on line 6

array(1) {
  [0]=>
  object(SimpleXMLElement)#3 (0) {
  }
}


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-02-22 08:52 UTC] tony2001@php.net
This error message comes from SimpleXML.
Reclassified.
 [2006-02-24 16:58 UTC] helly@php.net
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
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.

Use CVS and add new flag PDO:FETCH_PROPSLATE.

SimpleXMLElement does not allow to write properties prior to calling the ctor.

In 5.1 you would need to change to use FETCH_FUNC instead.
 [2006-02-24 17:05 UTC] helly@php.net
Make this PDO:FETCH_PROPS_LATE. The other developers didn't like the name without the '_'.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Dec 26 11:01:30 2024 UTC