note 88230 added to book.session
| From: | SomeGuy at osu1 dot php dot net | Date: | Fri, 16 Jan 2009 12:26:11 +0000 |
| Subject: | note 88230 added to book.session | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-149316@lists.php.net to get a copy of this message | ||
Just some notes - it seems that php does the session writing after the script exits.
For example, if you set a bunch of session variables and then run session_regenerate_id() - the
session variables are never written to the old session. The new session id is generated when you ask
it to be generated, but the session exists only in memory until after the script exits - when the
session is written and any and all session variables are written to it.
This caused me some confusion, as I'm running sessions in an sql database rather than flat
file, trying to do any manipulation of the session database directly in a script where you have run
session_regenerate_id() will fail for the new session ID because the insert hasn't been done
yet, and setting any session variables will only be written to the new session, even if set before
you regenerate the session ID.
Also - if using a database for sessions, make sure to use mysql_real_escape_string() before saving
any session variables.
----
Server IP: 209.41.74.194
Probable Submitter: 68.189.86.17
----
Manual Page -- http://www.php.net/manual/en/book.session.php
Edit -- https://master.php.net/note/edit/88230
Del: integrated -- https://master.php.net/note/delete/88230/integrated
Del: useless -- https://master.php.net/note/delete/88230/useless
Del: bad code -- https://master.php.net/note/delete/88230/bad+code
Del: spam -- https://master.php.net/note/delete/88230/spam
Del: non-english -- https://master.php.net/note/delete/88230/non-english
Del: in docs -- https://master.php.net/note/delete/88230/in+docs
Del: other reasons-- https://master.php.net/note/delete/88230
Reject -- https://master.php.net/note/reject/88230
Search -- https://master.php.net/manage/user-notes.php