Skip to content

Commit

Permalink
Merge branch '6.0' into 6.1
Browse files Browse the repository at this point in the history
* 6.0:
  [HttpFoundation] Fix session tests
  Bump Symfony version to 6.0.15
  Update VERSION for 6.0.14
  Update CHANGELOG for 6.0.14
  Bump Symfony version to 5.4.15
  Update VERSION for 5.4.14
  Update CHANGELOG for 5.4.14
  Bump Symfony version to 4.4.48
  Update VERSION for 4.4.47
  Update CONTRIBUTORS for 4.4.47
  Update CHANGELOG for 4.4.47
  • Loading branch information
nicolas-grekas committed Oct 12, 2022
2 parents 3ae8e9c + a93829f commit 792a185
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
14 changes: 12 additions & 2 deletions Tests/Session/Storage/Handler/Fixtures/common.inc
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,12 @@ ob_start();
class TestSessionHandler extends AbstractSessionHandler
{
private $data;
private $sessionId;

public function __construct($data = '')
public function __construct($data = '', $sessionId = null)
{
$this->data = $data;
$this->sessionId = $sessionId;
}

public function open(string $path, string $name): bool
Expand Down Expand Up @@ -130,21 +132,29 @@ class TestSessionHandler extends AbstractSessionHandler

protected function doRead($sessionId): string
{
echo __FUNCTION__.': ', $this->data, "\n";
if (isset($this->sessionId) && $sessionId !== $this->sessionId) {
echo __FUNCTION__ . ": invalid sessionId\n";

return '';
}
echo __FUNCTION__ . ': ', $this->data, "\n";
$this->sessionId = $sessionId;

return $this->data;
}

protected function doWrite($sessionId, $data): bool
{
echo __FUNCTION__.': ', $data, "\n";
$this->sessionId = $sessionId;

return true;
}

protected function doDestroy($sessionId): bool
{
echo __FUNCTION__, "\n";
$this->sessionId = '';

return true;
}
Expand Down
3 changes: 1 addition & 2 deletions Tests/Session/Storage/Handler/Fixtures/regenerate.expected
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@ close
open
validateId
read
doRead: abc|i:123;
doRead: invalid sessionId
read
doRead: abc|i:123;

write
doWrite: abc|i:123;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ close
open
validateId
read
doRead:
doRead: invalid sessionId
read

write
Expand Down

0 comments on commit 792a185

Please sign in to comment.