Bug #64917 [Opn->Dup]: Infinite loop when using SimpleXMLElement::attributes

From: Date: Fri, 04 Sep 2015 14:32:04 +0000
Subject: Bug #64917 [Opn->Dup]: Infinite loop when using SimpleXMLElement::attributes
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-195765@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=64917&edit=1 ID: 64917 Updated by: cmb@php.net Reported by: nabice at gmail dot com Summary: Infinite loop when using SimpleXMLElement::attributes -Status: Open +Status: Duplicate Type: Bug Package: SimpleXML related Operating System: Linux 3.8.0 PHP Version: 5.4.15 -Assigned To: +Assigned To: cmb Block user comment: N Private report: N New Comment: This is a duplicate of bug #55098. Previous Comments: ------------------------------------------------------------------------ [2013-05-24 15:38:43] aharvey@php.net Related To: Bug #64918 ------------------------------------------------------------------------ [2013-05-24 13:11:11] nabice at gmail dot com 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. ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=64917&edit=1

« previous php.bugs (#195765) next »