ID:               37875
 Comment by:       bullshitemail at juno dot com
 Reported By:      jona at oismail dot com
 Status:           No Feedback
 Bug Type:         SimpleXML related
 Operating System: Windows 2000
 PHP Version:      5.1.4
 New Comment:

I ran into the same issue:

 while (list($key, $questi) = each
(($HTTP_SESSION_VARS['scoreboard'][$cat]))) 

created an endless loop. I trouble shot it by creating: 

$a = 1;

while (list($key, $questi) = each
(($HTTP_SESSION_VARS['scoreboard'][$cat])) && $a < 10) { 

a++  

By adding the variable $a I limited the loops to 10 times so that it
would not crash my browser while I tried to figure out what was
happening.

>>>>>>>>>>>>>>>>  THE FIX  <<<<<<<<<<<<<<<<
I found that I had an extra set of brackets that I didn't need.

while (list($key, $questi) = each
($HTTP_SESSION_VARS['scoreboard'][$cat])) 

This worked for me hope that it helps someone.


Previous Comments:
------------------------------------------------------------------------

[2007-08-25 01:00:00] php-bugs at lists dot php dot net

No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".

------------------------------------------------------------------------

[2007-08-17 20:06:39] j...@php.net

Please try using this CVS snapshot:

  http://snaps.php.net/php5.2-latest.tar.gz
 
For Windows (zip):
 
  http://snaps.php.net/win32/php5.2-win32-latest.zip

For Windows (installer):

  http://snaps.php.net/win32/php5.2-win32-installer-latest.msi

Lot has changed since 5.1.4 so it's likely this is already fixed.

------------------------------------------------------------------------

[2007-06-13 02:39:24] pburney at lotsa dot net

I discovered this bug in one of my applications as well. In my case,
the item was a simple multidimensional array/hash:

$_SESSION['prefs'] = array();

$_SESSION['prefs']['something'] = 'something else';

while (list($key, $value) = each($_SESSION['prefs'])) {

   echo $key . ' is ' . $value . "\n";

}

would just run forever printing:

something is something else
something is something else
something is something else

------------------------------------------------------------------------

[2006-06-29 18:23:32] tys at tvg dot ca

Forgot to mention, the while code works on PHP verison 5.0.4 (cgi).

------------------------------------------------------------------------

[2006-06-29 18:21:50] tys at tvg dot ca

I'm running into the same bug but on a generic php PEAR DB object which
leads me to believe this isn't specific to Simple XML objects.

PHP 5.1.2 (cgi) (built: May  1 2006 01:12:05)
mysql  Ver 14.12 Distrib 5.0.18, for pc-linux-gnu (i686) using readline
5.0


while(list($key,$val)=each($main->getData())) enters an endless loop

foreach($main->getData() as $key=>$val) works fine

------------------------------------------------------------------------

The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
    http://bugs.php.net/37875

-- 
Edit this bug report at http://bugs.php.net/?id=37875&edit=1

Reply via email to