Skip to content

Commit 667e1dc

Browse files
committed
MC-38105: Unable to set native session handler that is different from the one define in php.ini
1 parent e845a96 commit 667e1dc

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

dev/tests/integration/testsuite/Magento/Framework/Session/SessionManagerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ public function testConstructor(string $saveMethod): void
326326
$this->assertArrayHasKey('session.use_only_cookies', self::$isIniSetInvoked);
327327
$this->assertEquals('1', self::$isIniSetInvoked['session.use_only_cookies']);
328328
foreach ($sessionConfig->getOptions() as $option => $value) {
329-
if ($option == 'session.save_handler' && $value == 'user') {
329+
if ($option === 'session.save_handler' && !$value === 'memcached') {
330330
$this->assertArrayNotHasKey('session.save_handler', self::$isIniSetInvoked);
331331
} else {
332332
$this->assertArrayHasKey($option, self::$isIniSetInvoked);

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -619,9 +619,9 @@ private function initIniOptions()
619619
}
620620

621621
foreach ($this->sessionConfig->getOptions() as $option => $value) {
622-
// It is now explicitly forbidden to set the module name to "user".
623-
// Formerly, this has been silently ignored.
624-
if ($option === 'session.save_handler' && $value === 'user') {
622+
// Since PHP 7.2 it is explicitly forbidden to set the module name to "user".
623+
// Need to skip all handlers except memcached. Redis and Db have implements SessionHandlerInterface.
624+
if ($option === 'session.save_handler' && !$value === 'memcached') {
625625
continue;
626626
} else {
627627
$result = ini_set($option, $value);

0 commit comments

Comments
 (0)