Skip to content

Commit e688b8a

Browse files
elioerminijignesh-baldha
authored andcommitted
Update from review
1 parent 5b6e78e commit e688b8a

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

lib/internal/Magento/Framework/Session/SessionManager.php

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@
55
* Copyright © Magento, Inc. All rights reserved.
66
* See COPYING.txt for license details.
77
*/
8-
9-
// @codingStandardsIgnoreFile
10-
118
namespace Magento\Framework\Session;
129

1310
use Magento\Framework\Session\Config\ConfigInterface;
@@ -18,6 +15,11 @@
1815
*/
1916
class SessionManager implements SessionManagerInterface
2017
{
18+
/**
19+
* Session destroyed threshold in seconds
20+
*/
21+
const SESSION_DESTROYED_THRESHOLD = 300;
22+
2123
/**
2224
* Default options when a call destroy()
2325
*
@@ -193,7 +195,7 @@ public function start()
193195
$this->setSessionId($sid);
194196
session_start();
195197
if (isset($_SESSION['destroyed'])) {
196-
if ($_SESSION['destroyed'] < time() - 300) {
198+
if ($_SESSION['destroyed'] < time() - self::SESSION_DESTROYED_THRESHOLD) {
197199
$this->destroy(['clear_storage' => true]);
198200
}
199201
}
@@ -511,32 +513,29 @@ public function regenerateId()
511513
return $this;
512514
}
513515

516+
// @codingStandardsIgnoreStart
514517
if ($this->isSessionExists()) {
515518
// Regenerate the session
516519
session_regenerate_id();
517520
$newSessionId = session_id();
518-
519521
$_SESSION['new_session_id'] = $newSessionId;
520-
521522
// Set destroy timestamp
522523
$_SESSION['destroyed'] = time();
523-
524524
// Write and close current session;
525525
session_commit();
526526
// Called after destroy()
527527
$oldSession = $_SESSION;
528528
// Start session with new session ID
529529
session_id($newSessionId);
530-
ini_set('session.use_strict_mode', 0);
531530
session_start();
532-
ini_set('session.use_strict_mode', 1);
533531
$_SESSION = $oldSession;
534532
// New session does not need them
535533
unset($_SESSION['destroyed']);
536534
unset($_SESSION['new_session_id']);
537535
} else {
538536
session_start();
539537
}
538+
// @codingStandardsIgnoreEnd
540539
$this->storage->init(isset($_SESSION) ? $_SESSION : []);
541540

542541
if ($this->sessionConfig->getUseCookies()) {

0 commit comments

Comments
 (0)