-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[HttpFoundation] PhpBridgeSessionStorage - Exceptions thrown when error reporting reports warnings. #8554
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
Comments
session_status() is not supported in php 5.3. :( |
O, right. Didn't realize that it was a relatively new feature. The
We could also be overly creative and just define the function. Would make the "official" function usable wherever available, which is a plus :-)
|
i'm pretty sure this has all well been discussed. As you can see that symfony uses the SessionHandlerInterface from php 5.4, but does not redefine session_status. Other folks who actually worked on this can chime in as to the reasons though. perhaps @Drak ? |
@jrobeson providing a stub for a function is harder than for a class/interface. Thanks to the autoloading, the class stub will not add any overhead when you have the native class (as the autoloader will never try to get the stub) while you need to have some logic executed all the time to load function stubs as they cannot be autoloaded |
@stof if it's possible to redo session_start() it'd be worth imo. I didn't think that was the only reason it wasn't done. |
@jrobeson the problem is the FC version of @AtliThor can you please post the exact warnings PHP generates? |
@Drak Sure, this is what Symfony's error page shows me
And this is the stack trace.
Looking closer at this now, it seems it's only complaining about the If the |
I think there is a mistake in the documentation. The purpose of the bridge is so you can use session handlers OUTSIDE of Symfony while still using the Symfony session API. If you have code that is starting the session outside of Symfony to use it's own save handlers, you do not want to tell Symfony to use save handlers.. the documentation seems mistaken: This is correct:
There are two separate cases:
In the second case, you have a system which has it's own session save handler. You should be using |
OK, I see. That appears to be spot on. I tried leaving out the handler_id as you suggested, and now the session is handled like I expected it to be handled with the handler_id set the native_file. No exceptions or warnings, and both my legacy code and Symfony's session API work side by side. The docs say: "If the application has sets it's own PHP save handler, you can specify null for the handler_id". I read this and, having created no save handlers myself, took it to mean that this would not work for me. So I moved on to the second snippet. - It would seem that this phrase is meant to include PHP's default save handler. |
I will correct the documentation. |
Closing now the documentation PR has been made. |
When configuring Symfony 2.3 to use
PhpBridgeSessionStorage
as proposed in the second snippet in this doc article:http://symfony.com/doc/2.3/cookbook/session/php_bridge.html
If the session is started in, or before, the standard app_dev.php script - or even the app.php script, if PHP is configured to display warnings - the two
ini_set
calls in theNativeFileSessionHandler
constructor will trigger PHP warnings, as the session_path and session_handler directives can't be set after the session is started. Symfony converts them into exceptions, halting the execution of the page.It would make more sense to check the session status in the constructor before issuing the ini_set calls, rather than relying on a lack of error reporting for this feature to be used in this manner. They would have no effect if the session is started either way.
The text was updated successfully, but these errors were encountered: