From:             jona at oismail dot com
Operating system: Windows 2000
PHP version:      5.1.4
PHP Bug Type:     SimpleXML related
Bug description:  while(list() = each() ) on simplexml_element loops forever

Description:
------------
When doing a while (list($key, $val) = each($obj_XML) ) on a Simple XML
object PHP loops forever.

Is this possibly related bug: #24945 foreach on simplexml_element loops
forever?
Please note, for each works but only output the tag not the attribute.

Found on Windows 2000 running IIS with PHP5.1.4 as an ISAPI module.

Reproduce code:
---------------
<?php
$sXML = '<?xml version="1.0" encoding="ISO-8859-5"?>
<root type="input">
<username>Jona</username>
</root>';

$obj_XML = simplexml_load_string($sXML);

while (list($key, $val) = each($obj_XML) )
{
        echo $key ." - ";
        if(is_array($val) === true)
        {
                while (list($k, $v) = each($val) )
                {
                        echo $k ." - ". $v;
                }
        }
        else
        {
                echo $val;
        }
        echo "<br />";
}
?>

Expected result:
----------------
@attributes - type - input
username - Jona

Actual result:
--------------
@attributes - type - input
@attributes - type - input
@attributes - type - input
@attributes - type - input
@attributes - type - input
@attributes - type - input
@attributes - type - input
@attributes - type - input
@attributes - type - input
@attributes - type - input
@attributes - type - input
@attributes - type - input
@attributes - type - input
@attributes - type - input
@attributes - type - input
@attributes - type - input
@attributes - type - input
@attributes - type - input
@attributes - type - input
@attributes - type - input
@attributes - type - input
@attributes - type - input
@attributes - type - input
@attributes - type - input
@attributes - type - input
@attributes - type - input
@attributes - type - input
@attributes - type - input
@attributes - type - input

etc.

-- 
Edit bug report at http://bugs.php.net/?id=37875&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=37875&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=37875&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=37875&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=37875&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=37875&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=37875&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=37875&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=37875&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=37875&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=37875&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=37875&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=37875&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=37875&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=37875&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=37875&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=37875&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=37875&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=37875&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=37875&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=37875&r=mysqlcfg

Reply via email to