-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
… before session closed
- Loading branch information
Showing
4 changed files
with
74 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -89,30 +89,19 @@ public function getUseCustomStorage() | |
|
||
/** | ||
* Composes storage field set for session writing. | ||
* @param string $id session id | ||
* @param string $data session data | ||
* @param string $id Optional session id | ||
* @param string $data Optional session data | ||
* @return array storage fields | ||
*/ | ||
protected function composeFields($id, $data) | ||
protected function composeFields($id = null, $data = null) | ||
{ | ||
$fields = [ | ||
'data' => $data, | ||
]; | ||
if ($this->writeCallback !== null) { | ||
$fields = array_merge( | ||
$fields, | ||
call_user_func($this->writeCallback, $this) | ||
); | ||
if (!is_string($fields['data'])) { | ||
$_SESSION = $fields['data']; | ||
$fields['data'] = session_encode(); | ||
} | ||
$fields = $this->writeCallback ? call_user_func($this->writeCallback, $this) : []; | ||
if ($id !== null) { | ||
$fields['id'] = $id; | ||
} | ||
if ($data !== null) { | ||
$fields['data'] = $data; | ||
} | ||
// ensure 'id' and 'expire' are never affected by [[writeCallback]] | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
samdark
Member
|
||
$fields = array_merge($fields, [ | ||
'id' => $id, | ||
'expire' => time() + $this->getTimeout(), | ||
]); | ||
return $fields; | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Removing this part caused some trouble in our live application as session id's and expire times were not preserved (e.g. on logins).
We currently added this code part in our
writeCallback
which solves the problem for us.Just wanted to raise attention on that as the change was not clearly documented.
Maybe you removed this code by accident...or was it intended?