Bug #64918 [Com]: Infinite loop when using SimpleXMLElement::attributes
| From: | nabice at gmail dot com | Date: | Sat, 25 May 2013 02:40:43 +0000 |
| Subject: | Bug #64918 [Com]: Infinite loop when using SimpleXMLElement::attributes | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-179129@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=64918&edit=1
ID: 64918
Comment by: nabice at gmail dot com
Reported by: nabice at gmail dot com
Summary: Infinite loop when using
SimpleXMLElement::attributes
Status: Duplicate
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:
Sorry, I thought I failed to submit 64917, so I submit this one.
Previous Comments:
------------------------------------------------------------------------
[2013-05-24 15:38:43] aharvey@php.net
Note to self: "submitted twice" isn't very useful. Sorry about the bugspam.
Duplicate of bug #64917, anyway.
------------------------------------------------------------------------
[2013-05-24 15:38:14] aharvey@php.net
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.
------------------------------------------------------------------------
[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