Edit report at https://bugs.php.net/bug.php?id=64918&edit=1

 ID:                 64918
 Updated by:         ahar...@php.net
 Reported by:        nabice at gmail dot com
 Summary:            Infinite loop when using
                     SimpleXMLElement::attributes
-Status:             Open
+Status:             Not a bug
 Type:               Bug
 Package:            SimpleXML related
 Operating System:   Linux 3.8.0
 PHP Version:        5.4.15
 Block user comment: N
 Private report:     N

 New Comment:

Please do not submit the same bug more than once. An existing
bug report already describes this very problem. Even if you feel
that your issue is somewhat different, the resolution is likely
to be the same. 

Thank you for your interest in PHP.




Previous Comments:
------------------------------------------------------------------------
[2013-05-24 13:18:41] 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=64918&edit=1

Reply via email to