Skip to content

Commit 1c12040

Browse files
fix(session start): Do not bounce if headers already sent
1 parent 75f0bcb commit 1c12040

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

inc/Bounce.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,10 @@ public function sendResponse(?string $body, int $statusCode = 200): void
317317

318318
public function safelyBounce(array $configs): bool
319319
{
320+
if (headers_sent()) {
321+
// We cannot start session when headers already sent
322+
return false;
323+
}
320324
// If there is any technical problem while bouncing, don't block the user. Bypass boucing and log the error.
321325
set_error_handler(function ($errno, $errstr) {
322326
throw new BouncerException("$errstr (Error level: $errno)");

0 commit comments

Comments
 (0)