note 90991 added to function.session-register

From: Date: Tue, 19 May 2009 23:15:07 +0000
Subject: note 90991 added to function.session-register
Groups: php.notes 
Request: Send a blank email to php-notes+get-155765@lists.php.net to get a copy of this message
For those of you who use this function (session_register that is), even though the manual does specify that this function implicitly calls session_start(), I just wanted to reiterate that fact. It is also important to know that if you ever switch from session_register to using $_SESSION, make sure to call session_start before adding items to the $_SESSION variable, because unlike session_register, no implicit call to session_start is done. Another reason I explain this is because I ran into a problem in which you can add items to the $_SESSION variable all you want, but if session_start is not called before adding them, they will not actually be saved to the session. Using the same code, though, and replacing the $_SESSION assignments with session_register without calling session_start WILL save that info to the session. It would be nice to have PHP check for writes to the $_SESSION variable and complain with a warning if session_start hasn't been called. ---- Server IP: 64.71.164.2 Probable Submitter: 209.63.134.99 ---- Manual Page -- http://www.php.net/manual/en/function.session-register.php Edit -- https://master.php.net/note/edit/90991 Del: integrated -- https://master.php.net/note/delete/90991/integrated Del: useless -- https://master.php.net/note/delete/90991/useless Del: bad code -- https://master.php.net/note/delete/90991/bad+code Del: spam -- https://master.php.net/note/delete/90991/spam Del: non-english -- https://master.php.net/note/delete/90991/non-english Del: in docs -- https://master.php.net/note/delete/90991/in+docs Del: other reasons-- https://master.php.net/note/delete/90991 Reject -- https://master.php.net/note/reject/90991 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#155765) next »