From: php dot bug at hebbron dot com
Operating system: Linux
PHP version: 5.0.4
PHP Bug Type: DOM XML related
Bug description: foreach($domElement->childNodes AS $child) produces fatal
error
Description:
------------
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"?>
<root>
<child></child>
<child></child>
<child></child>
<child></child>
</root>
XML;
$d->loadXML($xml);
foreach($d->documentElement->childNodes AS $child){
print($child->nodeName."\n");
}
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
--
Edit bug report at http://bugs.php.net/?id=32641&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=32641&r=trysnapshot4
Try a CVS snapshot (php5.0):
http://bugs.php.net/fix.php?id=32641&r=trysnapshot50
Try a CVS snapshot (php5.1):
http://bugs.php.net/fix.php?id=32641&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=32641&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=32641&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=32641&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=32641&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=32641&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=32641&r=support
Expected behavior: http://bugs.php.net/fix.php?id=32641&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=32641&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=32641&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=32641&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=32641&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=32641&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=32641&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=32641&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=32641&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=32641&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=32641&r=mysqlcfg