Re: note 69532 rejected and deleted from function.session-destroy by notes editor betz

From: Date: Sun, 10 Sep 2006 23:42:59 +0000
Subject: Re: note 69532 rejected and deleted from function.session-destroy by notes editor betz
Groups: php.notes 
Request: Send a blank email to php-notes+get-116991@lists.php.net to get a copy of this message
Your session_destroy() suggestion to reset a session by $_SESSION=array() is unsafe. You have deleted my posts twice, it is in your right, but if we both give up a bit of our narcissism maybe we can both provide a service to the community that reads you: sessions should not be reset via $_SESSION=array() as so stubbornly suggested, but with their native uninitialized value of NULL $_SESSION=null; If you don't like my posts, at least correct your suggestions with your own hands if mine are too dirty: you caused to me days of fruitless debugging simply because I blindly trusted your idea of unsetting via $_SESSION=array() and session_destroy(), whereas my checks were if(isset($_SESSION)) A manual like yours is presumed faultless by your readers, and the notes enough to accommodate all circumstances: $_SESSION=array() will backfire on whoever uses isset, whereas by using $_SESSION=null, this would NOT happen. It is enough to consider the latter more advisable. As for the rest do as you like: the site is yours, I have my solution, and if you prefer to keep an unsafe advice there also when you ahve a better one, your problem. -----Original message----- From: php-notes@lists.php.net Date: Sun, 10 Sep 2006 12:18:54 +0200 To: webmaster@unitedscripters.com Subject: note 69532 rejected and deleted from function.session-destroy by notes editor betz > You are receiving this email because your note posted > to the online PHP manual has been removed by one of the editors. > > Read the following paragraphs carefully, because they contain > pointers to resources better suited for requesting support or > reporting bugs, none of which are to be included in manual notes > because there are mechanisms and groups in place to deal with > those issues. > > The user contributed notes are not an appropriate place to > ask questions, report bugs or suggest new features; please > use the resources listed on <http://php.net/support> > for those purposes. This was clearly stated in the page > you used to submit your note, please carefully re-read > those instructions before submitting future contributions. > > Bug submissions and feature requests should be entered at > <http://bugs.php.net/>. For documentation errors use the > bug system, and classify the bug as "Documentation problem". > Support and ways to find answers to your questions can be found > at <http://php.net/support>. > > Your note has been removed from the online manual. > > ----- Copy of your note below ----- > > Please note that any advice to destroy a session via a command like: > > $_SESSION = array(); > > may lead to a catastrophe particularly if there is enough clout on it to induce you into > believing that must be quite sound an advice - meaning with catastrophe endless nights trying to > debug something elusive, because you thought that advice was authoritative. > > In fact, the correct way should be: > > $_SESSION=null; /*NULL, not array() !*/ > > The issue may be as follows: in order to reset the session you use $_SESSION=array() and then > you call on other stuff - well, the session still EXISTS as an array, and since your other lines of > codes are doing the right thing namely verifying whether (!$_SESSION), that checks invariably > fails.. > > If for any reason you are going to reset a session using an assignement, consider using =NULL. >

« previous php.notes (#116991) next »