|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2005-08-15 22:07 UTC] gary at garycarr dot net
Description: ------------ bug #28444 is back again, it was fixed in 5.0.3, but now is back again in 5.0.4. This is a duplicate bug, but it has been fixed and now is problem again, resubmitting for that reason. Reproduce code: --------------- $query = '//menus'; $nodelist = $xpath->query($query); if (isset($nodelist)) { foreach ($nodelist as $node){ if ($node->hasAttributes()){ foreach ($node->attributes as $attribute) { echo nl2br(print_r($attribute,true)); } } } } Expected result: ---------------- the details of each $attribute; Actual result: -------------- PHP Error "Cannot access undefined property for object with overloaded property access" on foreach line... PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 29 10:00:01 2025 UTC |
ok here is the complete test code : $xml='<?xml version="1.0" encoding = "UTF-8"?><menus name="Toolbar"><menu id="1" name="about"><text>Learn more about our company</text><icon>about.gif</icon></menu></menus>'; $domdoc = new domDocument; $domdoc->loadxml($xml); $xpath = new domXPath($domdoc); $query = '//menus/menu'; $nodelist = $xpath->query($query); if (isset($nodelist)) { foreach ($nodelist as $node){ if ($node->hasAttributes()){ foreach ($node->attributes as $attribute) { echo nl2br("$attribute->name = $attribute->value\n"); } } } }