|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2013-05-24 15:38 UTC] aharvey@php.net
-Status: Open
+Status: Not a bug
[2013-05-24 15:38 UTC] aharvey@php.net
[2013-05-24 15:38 UTC] aharvey@php.net
-Status: Not a bug
+Status: Duplicate
[2013-05-24 15:38 UTC] aharvey@php.net
[2013-05-25 02:40 UTC] nabice at gmail dot com
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 18:00:01 2025 UTC |
Description: ------------ When I use SimpleXML to find some element's attributes, A mistake leads to infinite loop. I was meaning "$child->atttibutes()", but "$childs->attributes()" by mistake, then some strange things happen: Infinite loop. Is it a bug? Test script: --------------- <?php $xml = simplexml_load_string('<root><parent><child id="1"/><child id="2"/></parent></root>'); $childs = $xml->parent->child; foreach($childs as $child){ var_dump($childs->attributes()); } ?> Expected result: ---------------- Print: object(SimpleXMLElement)#6 (1) { ["@attributes"]=> array(1) { ["id"]=> string(1) "1" } } object(SimpleXMLElement)#6 (1) { ["@attributes"]=> array(1) { ["id"]=> string(1) "1" } } Actual result: -------------- Infinite loop.