This repository was archived by the owner on Apr 29, 2019. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed
lib/internal/Magento/Framework/Session Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -199,12 +199,12 @@ public function start()
199
199
// Need to apply the config options so they can be ready by session_start
200
200
$ this ->initIniOptions ();
201
201
$ this ->registerSaveHandler ();
202
-
202
+ $ sid = $ this -> sidResolver -> getSid ( $ this );
203
203
// potential custom logic for session id (ex. switching between hosts)
204
- $ this ->setSessionId ($ this -> sidResolver -> getSid ( $ this ) );
204
+ $ this ->setSessionId ($ sid );
205
205
session_start ();
206
206
$ this ->validator ->validate ($ this );
207
- $ this ->renewCookie ();
207
+ $ this ->renewCookie ($ sid );
208
208
209
209
register_shutdown_function ([$ this , 'writeClose ' ]);
210
210
@@ -218,15 +218,18 @@ public function start()
218
218
/**
219
219
* Renew session cookie to prolong session
220
220
*
221
+ * @param null|string $sid If we have session id we need to use it instead of old cookie value
221
222
* @return $this
222
223
* @since 2.2.0
223
224
*/
224
- private function renewCookie ()
225
+ private function renewCookie ($ sid )
225
226
{
226
227
if (!$ this ->getCookieLifetime ()) {
227
228
return $ this ;
228
229
}
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 ());
230
233
if ($ cookieValue ) {
231
234
$ metadata = $ this ->cookieMetadataFactory ->createPublicCookieMetadata ();
232
235
$ metadata ->setPath ($ this ->sessionConfig ->getCookiePath ());
You can’t perform that action at this time.
0 commit comments