ID: 36646
Comment by: gmartyn at judicialtitle 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:
I am able to reproduce this bug with php 5.1.4 on IIS 6.
I also tried one of the solutions provided by the first comment:
$helper=array_keys($_SESSION);
foreach ($helper as $key){
unset($_SESSION[$key]);
}
..but after a print_r($_SESSION), I got this. Note the Access
Violation:
The session is now:
Array ( [numRecords] => 2 [curRecord] => 1 [curTab_r0] => Header
[curPartyType_r1] => d [numDebtors_r1] => 1 [numSecured_r1] => 1
[numProperty_r1] => 1 [curTab_r1] => Document [OriginalDocPgcnt_r1] =>
1PHP has encountered an Access Violation at 01E1CCA6 [curTab_r2] =>
Document [OriginalDocPgcnt_r2] => 2 [chkbox_doc_nonstd_r1] => false
[curPartyType_r2] => d [numDebtors_r2] => 1 [numSecured_r2] => 1
[numProperty_r2] => 1 )
Previous Comments:
------------------------------------------------------------------------
[2006-03-22 01:00:04] 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-03-14 12:45:45] [EMAIL PROTECTED]
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?
------------------------------------------------------------------------
[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