#24945 [Ver->Asn]: foreach on simplexml_element loops forever
| From: | sniper@php.net | Date: | Mon, 03 Nov 2003 23:23:37 +0000 |
| Subject: | #24945 [Ver->Asn]: foreach on simplexml_element loops forever | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-49911@lists.php.net to get a copy of this message | ||
ID: 24945
Updated by: sniper@php.net
Reported By: tater at potatoe dot com
-Status: Verified
+Status: Assigned
Bug Type: XML related
Operating System: *
PHP Version: 5CVS-2003-08-10 (dev)
Assigned To: sterling
Previous Comments:
------------------------------------------------------------------------
[2003-08-04 23:27:36] tater at potatoe dot com
Description:
------------
I don't even know if this is supposed to work yet or not.
May also be related to #24392 issues.
Doing foreach($xmlobject as $property => $value)
goes into an infinite loop. I tried it on a
stdClass object and it worked OK.
Oh and it segfaults when i bail with a user_error()
but who knows if that's related...
Reproduce code:
---------------
$xml = simplexml_load_string('<outer><inner>4</inner></outer>');
var_dump($xml);
$bound = 0;
foreach ($xml as $p => $v)
{
var_dump($p,$v);
if (++$bound > 5)
user_error("Yikes!", E_USER_ERROR);
}
Expected result:
----------------
object(simplexml_element)#1 (1) {
["inner"]=>
string(1) "4"
}
string(5) "inner"
string(1) "4"
Actual result:
--------------
object(simplexml_element)#1 (1) {
["inner"]=>
string(1) "4"
}
string(5) "inner"
string(1) "4"
string(5) "inner"
string(1) "4"
string(5) "inner"
string(1) "4"
string(5) "inner"
string(1) "4"
string(5) "inner"
string(1) "4"
string(5) "inner"
string(1) "4"
Fatal error: Yikes! in
/usr/local/book/apache/htdocs/cvsbook/php5/bugs/simplexml/test.php on
line 9
Segmentation fault
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=24945&edit=1