mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Optimize renew().
Don't call session_id() twice when we can use a local variable to store the current session id. Fixes #3531
This commit is contained in:
parent
c6d02d5779
commit
81875cfeb1
1 changed files with 7 additions and 5 deletions
|
@ -713,13 +713,15 @@ class CakeSession {
|
|||
* @return void
|
||||
*/
|
||||
public static function renew() {
|
||||
if (session_id()) {
|
||||
if (session_id() || isset($_COOKIE[session_name()])) {
|
||||
$id = session_id();
|
||||
if (!$id) {
|
||||
return;
|
||||
}
|
||||
if ($id || isset($_COOKIE[session_name()])) {
|
||||
setcookie(Configure::read('Session.cookie'), '', time() - 42000, self::$path);
|
||||
}
|
||||
session_regenerate_id(true);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method to set an internal error message.
|
||||
|
|
Loading…
Reference in a new issue