#36646 [Com]: foreach($_SESSION as $key => $value) unset($_SESSION[$key]) crashes apache2

[email protected] ("jay at websynergia dot com")
Newsgroups php.bugs
Message-ID <[email protected]>
 ID:               36646
 Comment by:       jay at websynergia dot com
 Reported By:      christian dot cal at gmx dot de
 Status:           No Feedback
 Bug Type:         Session related
 Operating System: Windows XP
 PHP Version:      5.1.2
 New Comment:

$_SESSION = array();

Why not just do the above if you want to clear the session array?

It has always worked for me regardless.


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

[2007-03-30 22:16:55] grafelbd at telstar-online dot net

I am using PHP 5.2.1 and I have tested this same issue with an array of
15 items with randomly generated strings, and this bug did not affect
me.

I tried using PHP 5.2.1 both as an Apache module (running Apache
2.0.59) and as a FastCGI but was unable to reproduce this error in
either setup.

I believe this bug might have been resolved in PHP 5.2.1 ? Unless all
of you are referring to Apache 2.2.x, which I have not tested.

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

[2007-03-30 00:17:05] no at email dot here

No crash for me, but I confirm the bug with php version 5.2.0 under
windows : no unset the variables

The proposed solution is OK :

$helper=&$_SESSION;
foreach ($helper as $key => $value){
  unset($helper[$key]);
}

Thanks

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

[2006-09-18 13:53:29] s dot stok at rollerscapes dot net

Im ussing the latest version of php5.2, and i also haffing this
problem.

The whird thing is that on my linux box everything works fine,only on
windows it fails to work.
Only the workaround makes it work.

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

[2006-08-27 01:12:36] joe at gmail dot com

Actually to clarify, it doesn't crash Apache on my computer, but it
doesn't unset the variables!

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

[2006-08-27 01:09:31] joe at gmail dot com

I'm running 5.1.6 and I have this problem... it still hasn't been
fixed!

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

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/36646

-- 
Edit this bug report at http://bugs.php.net/?id=36646&edit=1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.