#18071 [Fbk->Csd]: unset($_SESSION['name']); not works when varible is readed before unset
| From: | sniper@php.net | Date: | Wed, 11 Sep 2002 16:31:17 +0000 |
| Subject: | #18071 [Fbk->Csd]: unset($_SESSION['name']); not works when varible is readed before unset | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-19134@lists.php.net to get a copy of this message | ||
ID: 18071
Updated by: sniper@php.net
Reported By: lampa@brutusmud.net
-Status: Feedback
+Status: Closed
Bug Type: Session related
Operating System: win 2k, debian 2.2
PHP Version: 4.2.1
New Comment:
This bug has been fixed in CVS.
In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at http://snaps.php.net/.
In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.
In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites in short time.
Thank you for the report, and for helping us make PHP better.
Previous Comments:
------------------------------------------------------------------------
[2002-08-15 18:17:30] kalowsky@php.net
Please try a recent snapshot, of the non-stable kind. I believe Zeev
just fixed this (at least your test case works for me).
------------------------------------------------------------------------
[2002-08-08 08:33:16] andre@switch.no
Final note; we're currently running with register_globals on, while we
migrate old code. It seems that this is the reason
unset($_SESSION['varname']) won't work. But, the inconsistent behavior
(you can assign to $_SESSION but not unset variables from it), is
simply intolerable.
Either both:
$_SESSION['varname'] = 'value';
unset($_SESSION['varname']);
work as intended, even with register globals on, or none of them should
work. I would prefer them both to work because this will make it much
easier to migrate old code while still running with register globals
on.
------------------------------------------------------------------------
[2002-08-08 05:18:43] andre@switch.no
unset.php should be the name you save the testscript as...
------------------------------------------------------------------------
[2002-08-07 15:45:01] kalowsky@php.net
Your (andre@switch.no) sample script does not work for me. Results
look like:
session just after session_start()
Array
(
)
Next
and the Next link unset.php doesn't exist. Can you finish your test
case please?
------------------------------------------------------------------------
[2002-08-07 10:29:15] andre@switch.no
I have the same problem, running 4.1.1 on FreeBSD, put this script
somewhere at your site and run it:
session_start();
echo '<h2>Session just after session_start()</h2>';
echo '<pre>';
print_r($_SESSION);
echo '</pre>';
if(isset($_GET['set'])) {
$_SESSION['foo'] = 'bar';
echo '<h2>Session after $_SESSION[\'foo\'] =
\'bar\'</h2>';
echo '<pre>';
print_r($_SESSION);
echo '</pre>';
}
if(isset($_GET['unset'])) {
unset($_SESSION['foo']);
echo '<h2>Session after unset($_SESSION[\'foo\'])</h2>';
echo '<pre>';
print_r($_SESSION);
echo '</pre>';
}
if($_GET['step'] == 0) {
echo '<a href="unset.php?step=1&set=1">Next</a>';
}
if($_GET['step'] == 1) {
echo '<a href="unset.php?step=2">Next</a>';
}
if($_GET['step'] == 2) {
echo '<a href="unset.php?step=3&unset=1">Next</a>';
}
if($_GET['step'] == 3) {
echo '<a href="unset.php?step=4">Next</a>';
}
if($_GET['step'] == 4) {
echo '<p>$_SESSION should be an empty array at this point!</p>';
}
------------------------------------------------------------------------
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/18071
--
Edit this bug report at http://bugs.php.net/?id=18071&edit=1