note 28499 added to function.unset

From: Date: Tue, 14 Jan 2003 23:55:51 +0000
Subject: note 28499 added to function.unset
Groups: php.notes 
Request: Send a blank email to php-notes+get-42150@lists.php.net to get a copy of this message
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). -- http://www.php.net/manual/en/function.unset.php http://master.php.net/manage/user-notes.php?action=edit+28499 http://master.php.net/manage/user-notes.php?action=delete+28499 http://master.php.net/manage/user-notes.php?action=reject+28499

« previous php.notes (#42150) next »