Re: Re: unset($_SESSION[...]) vs. register_globals=On

From: Date: Thu, 28 Feb 2002 07:43:08 +0000
Subject: Re: Re: unset($_SESSION[...]) vs. register_globals=On
References: 1 2  Groups: php.dev 
Request: Send a blank email to php-dev+get-80499@lists.php.net to get a copy of this message
Hans Spath wrote:
Yasuo Ohgaki wrote:
Hans Spath wrote:
When register_globals is enabled, you can't unregister session variables via unset($_SESSION['varname']). How are php coders supposed to write clean code with that new autoglobal variable, when they have to have the same configuration at every server they run their scripts? I've written a bug report (#15551) which was classified as 'Bogus'. I don't think ignoring that problem is a good solution, so please review that bug report. Thanks. - Hans Spath
Use session_unset(). It does not create any inconsistency, not like session_register(), etc.
Then it should be changed in the documentation (ref.session....) where it says don't use session_unregister($var) (Caution block), use unset($_SESSION[$var]) (Example 3).
I noticed it causes segfault while ago and changed document to use $_SESSION = array() when register_globals if Off. (It's a little more efficient than session_unset()) When register_glaobals is On, user need to use session_unregister() I think mirror or master manaul is not updated, yet. This is one of the session module problem that I want to fix for PHP 4.3.0 :) i.e. Allow unset($_SESSION) or unset($HTTP_SESSION_VARS) to unset session vars regardless of register_globals setting. -- Yasuo Ohgaki

« previous php.dev (#80499) next »