Skip to content

Commit

Permalink
Merge branch '3.4' into 4.4
Browse files Browse the repository at this point in the history
* 3.4:
  [HttpFoundation] workaround PHP bug in the session module
  • Loading branch information
nicolas-grekas committed Apr 18, 2020
2 parents 1055c11 + eded33d commit ec5bd25
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
9 changes: 9 additions & 0 deletions Session/Storage/Handler/AbstractSessionHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,15 @@ public function validateId($sessionId)
$this->prefetchData = $this->read($sessionId);
$this->prefetchId = $sessionId;

if (\PHP_VERSION_ID < 70317 || (70400 <= \PHP_VERSION_ID && \PHP_VERSION_ID < 70405)) {
// work around https://bugs.php.net/79413
foreach (debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS) as $frame) {
if (!isset($frame['class']) && isset($frame['function']) && \in_array($frame['function'], ['session_regenerate_id', 'session_create_id'], true)) {
return '' === $this->prefetchData;
}
}
}

return '' !== $this->prefetchData;
}

Expand Down
1 change: 1 addition & 0 deletions Tests/Session/Storage/Handler/Fixtures/regenerate.expected
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ validateId
read
doRead: abc|i:123;
read
doRead: abc|i:123;

write
doWrite: abc|i:123;
Expand Down

0 comments on commit ec5bd25

Please sign in to comment.