Skip to content

[HttpFoundation] Failed to set session handler, headers already sent by phpunit #24524

Closed
@anlutro

Description

@anlutro
Q A
Bug report? yes
Feature request? no
BC Break report? yes
RFC? no
Symfony version 3.4.x

I have a project that depends on symfony/http-foundation. With 3.4.x-dev I'm getting some RuntimeErrors recently:

RuntimeException: Failed to set the session handler because headers have already been sent
by ".../vendor/phpunit/phpunit/src/Util/Printer.php" at line 110.

.../vendor/symfony/http-foundation/Session/Storage/NativeSessionStorage.php:397
.../vendor/symfony/http-foundation/Session/Storage/NativeSessionStorage.php:112
.../classes/Http/SessionProvider.php:128
.../vendor/autarky/container/classes/Factory/Factory.php:89
.../vendor/autarky/container/classes/Container.php:256
.../vendor/autarky/container/classes/Container.php:226
.../classes/Application.php:511
.../tests/unit/Session/SessionProviderTest.php:20

I tracked down the line to #23711 which was merged 2 days ago. If I remove the if headers_sent thing from setSaveHandler, my test runs fine again.

PHPUnit 5.7.22, symfony/http-foundation is at 0fe9b3d

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions