[HttpFoundation] workaround PHP bug in the session module

This commit is contained in:
Nicolas Grekas 2020-04-18 22:23:17 +02:00
parent a347a84453
commit 0cbca19edc
2 changed files with 10 additions and 0 deletions

View File

@ -71,6 +71,15 @@ abstract class AbstractSessionHandler implements \SessionHandlerInterface, \Sess
$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;
}

View File

@ -11,6 +11,7 @@ validateId
read
doRead: abc|i:123;
read
doRead: abc|i:123;
write
doWrite: abc|i:123;