mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 11:28:25 +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,12 +713,14 @@ class CakeSession {
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public static function renew() {
|
public static function renew() {
|
||||||
if (session_id()) {
|
$id = session_id();
|
||||||
if (session_id() || isset($_COOKIE[session_name()])) {
|
if (!$id) {
|
||||||
setcookie(Configure::read('Session.cookie'), '', time() - 42000, self::$path);
|
return;
|
||||||
}
|
|
||||||
session_regenerate_id(true);
|
|
||||||
}
|
}
|
||||||
|
if ($id || isset($_COOKIE[session_name()])) {
|
||||||
|
setcookie(Configure::read('Session.cookie'), '', time() - 42000, self::$path);
|
||||||
|
}
|
||||||
|
session_regenerate_id(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue