Skip to content

Commit ec5bd25

Browse files
Merge branch '3.4' into 4.4
* 3.4: [HttpFoundation] workaround PHP bug in the session module
2 parents 1055c11 + eded33d commit ec5bd25

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

Session/Storage/Handler/AbstractSessionHandler.php

+9
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,15 @@ public function validateId($sessionId)
7171
$this->prefetchData = $this->read($sessionId);
7272
$this->prefetchId = $sessionId;
7373

74+
if (\PHP_VERSION_ID < 70317 || (70400 <= \PHP_VERSION_ID && \PHP_VERSION_ID < 70405)) {
75+
// work around https://bugs.php.net/79413
76+
foreach (debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS) as $frame) {
77+
if (!isset($frame['class']) && isset($frame['function']) && \in_array($frame['function'], ['session_regenerate_id', 'session_create_id'], true)) {
78+
return '' === $this->prefetchData;
79+
}
80+
}
81+
}
82+
7483
return '' !== $this->prefetchData;
7584
}
7685

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

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ validateId
1111
read
1212
doRead: abc|i:123;
1313
read
14+
doRead: abc|i:123;
1415

1516
write
1617
doWrite: abc|i:123;

0 commit comments

Comments
 (0)