Skip to content
This repository was archived by the owner on Apr 29, 2019. It is now read-only.

Commit 82bbed0

Browse files
committed
Merge remote-tracking branch 'origin/MAGETWO-70671' into BUGS-2.2
2 parents 9badb94 + 9fd5992 commit 82bbed0

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

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

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -199,12 +199,12 @@ public function start()
199199
// Need to apply the config options so they can be ready by session_start
200200
$this->initIniOptions();
201201
$this->registerSaveHandler();
202-
202+
$sid = $this->sidResolver->getSid($this);
203203
// potential custom logic for session id (ex. switching between hosts)
204-
$this->setSessionId($this->sidResolver->getSid($this));
204+
$this->setSessionId($sid);
205205
session_start();
206206
$this->validator->validate($this);
207-
$this->renewCookie();
207+
$this->renewCookie($sid);
208208

209209
register_shutdown_function([$this, 'writeClose']);
210210

@@ -218,15 +218,18 @@ public function start()
218218
/**
219219
* Renew session cookie to prolong session
220220
*
221+
* @param null|string $sid If we have session id we need to use it instead of old cookie value
221222
* @return $this
222223
* @since 2.2.0
223224
*/
224-
private function renewCookie()
225+
private function renewCookie($sid)
225226
{
226227
if (!$this->getCookieLifetime()) {
227228
return $this;
228229
}
229-
$cookieValue = $this->cookieManager->getCookie($this->getName());
230+
//When we renew cookie, we should aware, that any other session client do not
231+
//change cookie too
232+
$cookieValue = $sid ?: $this->cookieManager->getCookie($this->getName());
230233
if ($cookieValue) {
231234
$metadata = $this->cookieMetadataFactory->createPublicCookieMetadata();
232235
$metadata->setPath($this->sessionConfig->getCookiePath());

0 commit comments

Comments
 (0)