note 73892 added to function.session-write-close

From: Date: Wed, 14 Mar 2007 19:37:18 +0000
Subject: note 73892 added to function.session-write-close
Groups: php.notes 
Request: Send a blank email to php-notes+get-124447@lists.php.net to get a copy of this message
This function is useful for forcing serialization of session data but it can introduce difficult-to-track bugs if it's called more than once per session_start() call. Since it doesn't have a return value or raise an exception there won't be any indication that the serialization failed and the code will continue normally. Only when a user visits a page that depends on unsaved session data will there be any indication of the failure. As far as I can tell this affects both the default and custom session handling functions. <? session_start(); $_SESSION['foo'] = 'box'; session_write_close(); if (array_key_exists('visited',$_SESSION) { echo "welcome back!\n"; # will never happen } else { echo "I don't know you.\n"; $_SESSION['visited'] = true; session_write_close(); } ?> ---- Server IP: 64.71.164.2 Probable Submitter: 192.68.202.187 ---- Manual Page -- http://www.php.net/manual/en/function.session-write-close.php Edit -- https://master.php.net/note/edit/73892 Del: integrated -- https://master.php.net/note/delete/73892/integrated Del: useless -- https://master.php.net/note/delete/73892/useless Del: bad code -- https://master.php.net/note/delete/73892/bad+code Del: spam -- https://master.php.net/note/delete/73892/spam Del: non-english -- https://master.php.net/note/delete/73892/non-english Del: in docs -- https://master.php.net/note/delete/73892/in+docs Del: other reasons-- https://master.php.net/note/delete/73892 Reject -- https://master.php.net/note/reject/73892 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#124447) next »