Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/AC-2883' into Hammer_QaulityBack…
Browse files Browse the repository at this point in the history
…log_GraphQL_24052022
  • Loading branch information
glo71317 committed May 30, 2022
2 parents 629e9d9 + a8ff9a6 commit 7a64e50
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/internal/Magento/Framework/Session/SaveHandler.php
Expand Up @@ -126,7 +126,7 @@ public function read($sessionId): string
$sessionMaxSize = $this->sessionMaxSizeConfig->getSessionMaxSize();
$sessionSize = strlen($sessionData);

if ($sessionSize !== null && $sessionMaxSize < $sessionSize) {
if ($sessionMaxSize !== null && $sessionMaxSize < $sessionSize) {
$sessionData = '';
if ($this->appState->getAreaCode() === Area::AREA_FRONTEND) {
$this->messageManager->addErrorMessage(
Expand Down
Expand Up @@ -132,7 +132,7 @@ public function testWriteMoreThanSessionMaxSize(): void

$this->assertTrue($this->saveHandler->write("test_session_id", "testdata"));
}

public function testReadMoreThanSessionMaxSize(): void
{
$this->sessionMaxSizeConfigMock
Expand All @@ -148,4 +148,20 @@ public function testReadMoreThanSessionMaxSize(): void

$this->assertEquals(null, $this->saveHandler->read("test_session_id"));
}

public function testReadSessionMaxZero(): void
{
$this->sessionMaxSizeConfigMock
->expects($this->once())
->method('getSessionMaxSize')
->willReturn(0);

$this->saveHandlerAdapterMock
->expects($this->once())
->method('read')
->with('test_session_id')
->willReturn('test_session_data');

$this->assertEquals(null, $this->saveHandler->read("test_session_id"));
}
}

0 comments on commit 7a64e50

Please sign in to comment.