note 94475 added to function.session-write-close

From: Date: Sat, 07 Nov 2009 11:39:22 +0000
Subject: note 94475 added to function.session-write-close
Groups: php.notes 
Request: Send a blank email to php-notes+get-162471@lists.php.net to get a copy of this message
I have a script that redirected a user using header() to a new location and had to store session data before the redirect takes place (not using cookies, just passing sid). This was working perfectly fine in PHP4, but when using PHP5 the session file was stored with variables not containing any values. After hours of debugging, I found out that in my case the session keys didn't get saved with any values, as I was using the underscore (_) sign in the session key. eg $test = "Value"; $_SESSION['my_variable'] = $test; just stored an empty value in $_SESSION['my_variable']. after omitting the _ sign and using $_SESSION['myvariable'] = $test; all problems were gone and the session was saved correctly before the header() redirect. It made no difference if I was using session_write_close() before the header() call. The problem was just with the _ sign in the key. ---- Server IP: 62.2.182.223 Probable Submitter: 193.223.241.5 ---- Manual Page -- http://www.php.net/manual/en/function.session-write-close.php Edit -- https://master.php.net/note/edit/94475 Del: integrated -- https://master.php.net/note/delete/94475/integrated Del: useless -- https://master.php.net/note/delete/94475/useless Del: bad code -- https://master.php.net/note/delete/94475/bad+code Del: spam -- https://master.php.net/note/delete/94475/spam Del: non-english -- https://master.php.net/note/delete/94475/non-english Del: in docs -- https://master.php.net/note/delete/94475/in+docs Del: other reasons-- https://master.php.net/note/delete/94475 Reject -- https://master.php.net/note/reject/94475 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#162471) next »