note 74772 added to function.session-write-close
| From: | riconagtalon at gmail dot com | Date: | Thu, 26 Apr 2007 22:11:47 +0000 |
| Subject: | note 74772 added to function.session-write-close | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-125901@lists.php.net to get a copy of this message | ||
I was having trouble with session data being lost / not carrying over to other pages when using
header("Location: ..."), and session_write_close() was not helping.
I was writing to $_SESSION by doing:
$_SESSION = $myArray;
I eventually found that doing it this way helped:
foreach($myArray as $k => $v)
{
$_SESSION[$k] = $v;
}
The problem was strange; I've assigned arrays to $_SESSION countless times and never had
trouble with it. In fact, I was doing it in many places elsewhere in the same application, and I
never ran into any problems.
I spent hours figuring out what was happening. Hope this saves time for somebody out there.
----
Server IP: 69.39.81.135
Probable Submitter: 72.164.243.26
----
Manual Page -- http://www.php.net/manual/en/function.session-write-close.php
Edit -- https://master.php.net/note/edit/74772
Del: integrated -- https://master.php.net/note/delete/74772/integrated
Del: useless -- https://master.php.net/note/delete/74772/useless
Del: bad code -- https://master.php.net/note/delete/74772/bad+code
Del: spam -- https://master.php.net/note/delete/74772/spam
Del: non-english -- https://master.php.net/note/delete/74772/non-english
Del: in docs -- https://master.php.net/note/delete/74772/in+docs
Del: other reasons-- https://master.php.net/note/delete/74772
Reject -- https://master.php.net/note/reject/74772
Search -- https://master.php.net/manage/user-notes.php