8000 bug #36490 [HttpFoundation] workaround PHP bug in the session module … · symfony/symfony@62565a1 · GitHub
[go: up one dir, main page]

Skip to content

Commit 62565a1

Browse files
bug #36490 [HttpFoundation] workaround PHP bug in the session module (nicolas-grekas)
This PR was merged into the 3.4 branch. Discussion ---------- [HttpFoundation] workaround PHP bug in the session module | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | - | License | MIT | Doc PR | - Current tests fail after php/php-src#5305 Which itself is a patch for a bug in the session module. This PR works around the issue in older versions of PHP and fixes the tests. Commits ------- 0cbca19 [HttpFoundation] workaround PHP bug in the session module
2 parents a347a84 + 0cbca19 commit 62565a1

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

src/Symfony/Component/HttpFoundation/Session/Storage/Handler/AbstractSessionHandler.php

Lines changed: 9 additions & 0 deletions
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

src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/Fixtures/regenerate.expected

Lines changed: 1 addition & 0 deletions
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)
0