note 28499 deleted from function.unset by sniper
| From: | sniper@php.net | Date: | Mon, 13 Oct 2003 02:28:50 +0000 |
| Subject: | note 28499 deleted from function.unset by sniper | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-58488@lists.php.net to get a copy of this message | ||
Note Submitter: php.net@davidmcarthur.com
----
My experience with unset($_SESSION['x']) differs from that of "radu dot rendec at
ines dot ro". Using his(her?) example script:
pageload 1: test.php
Notice: Undefined index: x in test.php on line 5
NULL not set
pageload 2: test.php?save=foobar
string(6) "foobar" is set
3. test.php?del=1
Notice: Undefined index: x in test.php on line 5
NULL not set
4. test.php
Notice: Undefined index: x in test.php on line 5
NULL not set
The session var stays gone. The differences may stem from the session handler. I'm using a
custom handler that writes to a database, though I'm using the default serializer. Obviously
the serialized string that my write handler receives doesn't have x in it after
unset($_SESSION['x']), and I update the database accordingly. However, I could imagine a
session write handler that might optimize this incorrectly (e.g. not writing at all when the
serialized string is empty).