-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Session] bad design / invalid calls / interface not respected #9233
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
I also wonder about the session class design at whole.
cc @Drak |
@Tobion the issue is that the Session in 2.0 was not based on the SessionHandler interface of PHP 5.4+. At this time, the SessionStorage were used. But this implementation was creating a bunch of issues, and so the session system was reworked to fit better with the way PHP sessions work. Removing the SessionStorage was not possible for BC reasons |
Yes but even before PHP 5.4 session save handlers existed (just without interface). The session subsystem is really a mess at the moment in symfony. |
What about return back to this issue before 3.0? |
For me the major challenge is that SessionBagInterface doesn't declare the get/set methods that all of its implementations contain, so it throws warnings in the IDE (and arguably breaks the spec) Simply adding get/set methods would go a long way to fixing this. |
SessionStorageInterface->getBag()->remove()
. This call is not valid because getBag returns a SessionBagInterface which does not have a remove() method. The remove method and some other methods are only defined for SessionAttributeBagInterface. There is a specialgetMetadataBag
in session and storage to access specific methods on the metadatabag. But there is none for the AttributeBag. Design seems to have holes.So you could create fatal errors through symfony by
setName
method which is not part of the interface. IMO it should be removed and the name should be part of the constructor instead. I don't see why the name is mutable and can make things out-of-synch with the Storage::registerBag functionality.SessionInterface::start
return value makes no sense. It returnsbool
but also throws Exception when it does not work which conflicts with each other. Either return a bool and don't throw exception or don't have a return value at all because an exception already says whether it worked or not.The text was updated successfully, but these errors were encountered: