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:
mark_story 2014-05-22 14:28:56 -04:00
parent c6d02d5779
commit 81875cfeb1

View file

@ -713,12 +713,14 @@ class CakeSession {
* @return void
*/
public static function renew() {
if (session_id()) {
if (session_id() || isset($_COOKIE[session_name()])) {
setcookie(Configure::read('Session.cookie'), '', time() - 42000, self::$path);
}
session_regenerate_id(true);
$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);
}
/**