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

From: Date: Fri, 30 Mar 2007 00:17:06 +0000
Subject: #36646 [Com]: foreach($_SESSION as $key => $value) unset($_SESSION[$key]) crashes apache2
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-110945@lists.php.net to get a copy of this message
ID: 36646 Comment by: no at email dot here 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: 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 Previous Comments: ------------------------------------------------------------------------ [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! ------------------------------------------------------------------------ [2006-08-02 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". ------------------------------------------------------------------------ [2006-07-25 16:30:02] gmartyn at judicialtitle dot com Ugh, looks like I was affected by this bug after all.. the array_merge was a problem, but so was the foreach over the $_SESSION. I got my script working by using the trick provided in the first comment: $helper=&$_SESSION; foreach ($helper as $key => $value){ unset($helper[$key]); } ------------------------------------------------------------------------ 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

« previous php.bugs (#110945) next »