ID: 36646 Updated by: [EMAIL PROTECTED] Reported By: christian dot cal at gmx dot de -Status: Open +Status: Feedback Bug Type: Session related Operating System: Windows XP PHP Version: 5.1.2 New Comment:
Please try using this CVS snapshot: http://snaps.php.net/php5.1-latest.tar.gz For Windows: http://snaps.php.net/win32/php5.1-win32-latest.zip I have just tested your test case and it works fine here. Do you do session_start() on a page which unsets $_SESSION? Previous Comments: ------------------------------------------------------------------------ [2006-03-07 18:29:37] christian dot cal at gmx dot de I recently figured out that apache crashed when running into an infinitive loop it ran by using header("Location: "), because the vars in $_SESSION wasn't unset by unset(). I believe the error with not unsetting vars in foreach() has been posted. ------------------------------------------------------------------------ [2006-03-07 15:04:48] christian dot cal at gmx dot de Description: ------------ I am using PHP as an apache2 modul. When trying to unset all vars that are stored in $_SESSION i use a foreach loop combined with unset. This method crashes the apache2. I moved from PHP 4.4.2 to 5.1.2. The unmodified code works for 4.4.2 but crashes the server when using 5.1.2. Reproduce code: --------------- foreach ($_SESSION as $key => $value){ unset($_SESSION[$key]); } Expected result: ---------------- All vars should be removed from $_SESSION So i tried this: $helper=&$_SESSION; foreach ($helper as $key => $value){ unset($helper[$key]); } This code does what I have expected from the code above. Also this works: $helper=array_keys($_SESSION); foreach ($helper as $key){ unset($_SESSION[$key]); } ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=36646&edit=1