File tree Expand file tree Collapse file tree 2 files changed +28
-1
lines changed
lib/internal/Magento/Framework/Session Expand file tree Collapse file tree 2 files changed +28
-1
lines changed Original file line number Diff line number Diff line change 8
8
namespace Magento \Framework \Session ;
9
9
10
10
use Magento \Framework \Session \Config \ConfigInterface ;
11
+ use Magento \Framework \Stdlib \Cookie \CookieMetadata ;
11
12
12
13
/**
13
14
* Session Manager
@@ -188,6 +189,7 @@ public function start()
188
189
$ this ->setSessionId ($ this ->sidResolver ->getSid ($ this ));
189
190
session_start ();
190
191
$ this ->validator ->validate ($ this );
192
+ $ this ->renewCookie ();
191
193
192
194
register_shutdown_function ([$ this , 'writeClose ' ]);
193
195
@@ -198,6 +200,32 @@ public function start()
198
200
return $ this ;
199
201
}
200
202
203
+ /**
204
+ * Renew session cookie to prolong session
205
+ *
206
+ * @return $this
207
+ */
208
+ private function renewCookie ()
209
+ {
210
+ if (!$ this ->getCookieLifetime ()) {
211
+ return $ this ;
212
+ }
213
+ $ this ->cookieManager ->setPublicCookie (
214
+ $ this ->getName (),
215
+ $ this ->getSessionId (),
216
+ $ this ->cookieMetadataFactory ->createPublicCookieMetadata (
217
+ [
218
+ CookieMetadata::KEY_DURATION => $ this ->getCookieLifetime (),
219
+ CookieMetadata::KEY_DOMAIN => $ this ->sessionConfig ->getCookieDomain (),
220
+ CookieMetadata::KEY_PATH => $ this ->sessionConfig ->getCookiePath (),
221
+ CookieMetadata::KEY_SECURE => $ this ->sessionConfig ->getCookieSecure (),
222
+ CookieMetadata::KEY_HTTP_ONLY => $ this ->sessionConfig ->getCookieHttpOnly ()
223
+ ]
224
+ )
225
+ );
226
+ return $ this ;
227
+ }
228
+
201
229
/**
202
230
* Register save handler
203
231
*
Original file line number Diff line number Diff line change @@ -52,7 +52,6 @@ class SessionManagerTest extends \PHPUnit_Framework_TestCase
52
52
53
53
protected function setUp ()
54
54
{
55
- $ this ->markTestSkipped ('To be fixed in MAGETWO-34751 ' );
56
55
global $ mockPHPFunctions ;
57
56
require_once __DIR__ . '/_files/mock_ini_set.php ' ;
58
57
require_once __DIR__ . '/_files/mock_session_regenerate_id.php ' ;
You can’t perform that action at this time.
0 commit comments