Fix notice that the session has been already started after retrieving its id

This commit is contained in:
Johannes Meyer 2014-07-16 15:38:39 +02:00
parent 1ad263170e
commit 5c507d5d91
1 changed files with 9 additions and 2 deletions

View File

@ -196,8 +196,15 @@ class PhpSession extends Session
*/
public function getId()
{
$this->open(); // Make sure we actually get a id
return session_id();
if (($id = session_id()) === '') {
// Make sure we actually get a id
$this->open();
session_write_close();
$this->hasBeenTouched = true;
$id = session_id();
}
return $id;
}
/**