Skip to content

Commit a93829f

Browse files
Merge branch '5.4' into 6.0
* 5.4: [HttpFoundation] Fix session tests 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
2 parents e8aa505 + 75bd663 commit a93829f

File tree

3 files changed

+14
-5
lines changed

3 files changed

+14
-5
lines changed

Tests/Session/Storage/Handler/Fixtures/common.inc

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,12 @@ ob_start();
5454
class TestSessionHandler extends AbstractSessionHandler
5555
{
5656
private $data;
57+
private $sessionId;
5758

58-
public function __construct($data = '')
59+
public function __construct($data = '', $sessionId = null)
5960
{
6061
$this->data = $data;
62+
$this->sessionId = $sessionId;
6163
}
6264

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

131133
protected function doRead($sessionId): string
132134
{
133-
echo __FUNCTION__.': ', $this->data, "\n";
135+
if (isset($this->sessionId) && $sessionId !== $this->sessionId) {
136+
echo __FUNCTION__ . ": invalid sessionId\n";
137+
138+
return '';
139+
}
140+
echo __FUNCTION__ . ': ', $this->data, "\n";
141+
$this->sessionId = $sessionId;
134142

135143
return $this->data;
136144
}
137145

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

142151
return true;
143152
}
144153

145154
protected function doDestroy($sessionId): bool
146155
{
147156
echo __FUNCTION__, "\n";
157+
$this->sessionId = '';
148158

149159
return true;
150160
}

Tests/Session/Storage/Handler/Fixtures/regenerate.expected

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,8 @@ close
99
open
1010
validateId
1111
read
12-
doRead: abc|i:123;
12+
doRead: invalid sessionId
1313
read
14-
doRead: abc|i:123;
1514

1615
write
1716
doWrite: abc|i:123;

Tests/Session/Storage/Handler/Fixtures/with_samesite_and_migration.expected

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ close
88
open
99
validateId
1010
read
11-
doRead:
11+
doRead: invalid sessionId
1212
read
1313

1414
write

0 commit comments

Comments
 (0)