-
-
Notifications
You must be signed in to change notification settings - Fork 9.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[HttpFoundation] Failed to set session handler, headers already sent by phpunit #24524
Comments
You're going to have this error anyway when running on PHP 7.2, so you should fix your tests. |
@nicolas-grekas I think the issue is a bit deeper. What's new in PHP 7.2 is that PHP won't allow you anymore to change the session's ini settings or save handlers after the session has been started. This should be fixed in #24516 (i.e. you will get an exception only if you try to change things while creating the |
…e with PHP 7.2 (sroze) This PR was merged into the 2.7 branch. Discussion ---------- [HttpFoundation] Fix forward-compat of NativeSessionStorage with PHP 7.2 | Q | A | ------------- | --- | Branch? | 2.7 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #24524 | License | MIT | Doc PR | ø PHP 7.2 disallow setting session options when the session was already started. This PR will not set any option if the session is already started and throw an exception if trying to do so with custom options. Commits ------- 00a1357 [HttpFoundation] Fix forward-compat of NativeSessionStorage with PHP 7.2
This should be merged in |
Also, I tried a dirty hack, by copying |
Upgraded to @nicolas-grekas I think we should reopen. |
This PR was squashed before being merged into the 4.0-dev branch (closes #24516). Discussion ---------- [Process] Fix broken tests for PHP 7.2 | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | no | Fixed tickets | #24524, #24515 | License | MIT | Doc PR | ø Following #24515, trying to fix Process tests with PHP 7.2 Commits ------- b410a36 [Process] Fix broken tests for PHP 7.2
Any sort of hack we can use in the meantime? |
I'm getting this error when |
would anyone be able to provide a short reproducer we could work on? |
I did a |
Looks like it was fixed in #24952. Closing. |
Maybe not. <?php
class SessionTest extends PHPUnit_Framework_TestCase {
public function test_session() {
$h = new \Symfony\Component\HttpFoundation\Session\Storage\Handler\NativeFileSessionHandler();
}
}
Should I re-open or create a new issue? It seems like almost the same issue. |
I have a project that depends on symfony/http-foundation. With 3.4.x-dev I'm getting some RuntimeErrors recently:
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
The text was updated successfully, but these errors were encountered: