#32104 [Opn->Fbk]: foreach on $dom->documentElement->childNode causes strange error
| From: | rrichards@php.net | Date: | Fri, 25 Feb 2005 14:01:59 +0000 |
| Subject: | #32104 [Opn->Fbk]: foreach on $dom->documentElement->childNode causes strange error | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-74578@lists.php.net to get a copy of this message | ||
ID: 32104
Updated by: rrichards@php.net
Reported By: ppetermann at vivaplus dot tv
-Status: Open
+Status: Feedback
Bug Type: DOM XML related
Operating System: tested on Linux and Solaris
PHP Version: 5CVS-2005-02-25 (dev)
New Comment:
sure you are using the latest snapshot?
using your code I get (both with latest 5_0 and HEAD):
Warning: Invalid argument supplied for foreach() in N:\CVS
Projects\php5_0\Debug_TS\bug32104.php on line 4
using ->childNodes (which is correct) works fine
Previous Comments:
------------------------------------------------------------------------
[2005-02-25 11:44:15] ppetermann at vivaplus dot tv
Description:
------------
doing a foreach loop on:
$dom->documentElement->childNode
causes an Fatal Error:
Fatal error: Cannot access undefined property for object with
overloaded property access in FILE on line LINENUMBEROFFOREACH
this didnt happen in PHP5 <= 5.0.3
Reproduce code:
---------------
<?php
$dom = new DomDocument();
$dom->load("xmlfile.xml);
foreach($dom->documentElement->childNode as $node)
{
echo "foo\n";
}
?>
Expected result:
----------------
a foo\n for each childnode of the document element
Actual result:
--------------
Fatal error: Cannot access undefined property for object with
overloaded property access in /foo/bar/myfile.php on line 4
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=32104&edit=1