|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #64918 Infinite loop when using SimpleXMLElement::attributes
Submitted: 2013-05-24 13:18 UTC Modified: 2013-05-24 15:38 UTC
From: nabice at gmail dot com Assigned:
Status: Duplicate Package: SimpleXML related
PHP Version: 5.4.15 OS: Linux 3.8.0
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
40 - 6 = ?
Subscribe to this entry?

 [2013-05-24 13:18 UTC] nabice at gmail dot com
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:
$xml = simplexml_load_string('<root><parent><child id="1"/><child id="2"/></parent></root>');
$childs = $xml->parent->child;
foreach($childs as $child){

Expected result:

object(SimpleXMLElement)#6 (1) {
  array(1) {
    string(1) "1"
object(SimpleXMLElement)#6 (1) {
  array(1) {
    string(1) "1"

Actual result:
Infinite loop.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2013-05-24 15:38 UTC]
-Status: Open +Status: Not a bug
 [2013-05-24 15:38 UTC]
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 15:38 UTC]
-Status: Not a bug +Status: Duplicate
 [2013-05-24 15:38 UTC]
Note to self: "submitted twice" isn't very useful. Sorry about the bugspam.

Duplicate of bug #64917, anyway.
 [2013-05-25 02:40 UTC] nabice at gmail dot com
Sorry, I thought I failed to submit 64917, so I submit this one.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 21:01:30 2024 UTC