|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #32641 foreach($domElement->childNodes AS $child) produces fatal error
Submitted: 2005-04-09 10:55 UTC Modified: 2005-04-09 11:35 UTC
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: php dot bug at hebbron dot com Assigned:
Status: Not a bug Package: DOM XML related
PHP Version: 5.0.4 OS: Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: php dot bug at hebbron dot com
New email:
PHP Version: OS:


 [2005-04-09 10:55 UTC] php dot bug at hebbron dot com
The following code works fine on 5.0.2, but causes the fatal error on 5.0.4. Using for($i; $i<$d->documentElement->childNodes->length; $i++){} loop works fine, bt the foreach version is now broken.

Reproduce code:
$d = new DOMDocument();
$xml = <<<XML
<?xml version="1.0" encoding="UTF-8"?>
foreach($d->documentElement->childNodes AS $child){

Expected result:
#text child #text child #text child #text child #text child #text  

Actual result:
Fatal error: Cannot access undefined property for object with overloaded property access in /home/tom/test/bug_reports/overloaded.php on line 15


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2005-04-09 11:34 UTC] php dot bug at hebbron dot com
Apologies: tried again on another machine - I thought I'd disabled the Zend debugger but hadn't. It was the interaction with the debugger that was causing the problem.
 [2005-04-09 11:35 UTC] php dot bug at hebbron dot com
See above - bogus
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Tue Jul 27 08:01:24 2021 UTC