My first impulse was to implement a SessionHandler class with a pair of methods to initialize it from a ServerRequestInterface, and apply the cookie back to a ResponseInterface instance e.g. via middleware.
However, it turns out, there does not appear to be any way to suppress the built-in PHP behavior that causes it to send a cookie.That means, session handling has to lead a separate life, outside of our shiny new HTTP components.
Or, we have to throw away standard session handling entirely, and a wealth of off-the-shelf components that rely on it, and rebuild everything from the ground up - which is what we ended up doing - and it's a lot more work than expected.So now, anything that relies on the session_*() functions or the $_SESSION superglobal is off-limits and can't be part of our stack.The alternative is worse (in my opinion) - that is, let the standard session module just do it's thang, and wave goodbye to all the benefits this was supposed to give in terms of testing; suddenly, any controller that does anything related to sessions, has to be run in an actual server context, because the HTTP components do not cover that.
Because this really sucks, and I am inches from recommending we drop PSR-7 and middleware entirely, because of this, and go back to the old-fashioned way of doing things, simple resource models and a delivery system with header() calls and echo statements... the price in terms of complexity is too high, and the benefits are too small. Just my opinion, but we were hoping this would make this simpler, not more complicated.
--
You received this message because you are subscribed to the Google Groups "PHP Framework Interoperability Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to php-fig+u...@googlegroups.com.
To post to this group, send email to php...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/php-fig/cfc6e290-755d-4957-aedd-34dfd64ea1b8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
If I may ask, which PSR-7 implementation are you using?
To view this discussion on the web visit https://groups.google.com/d/msgid/php-fig/415f67a4-8b95-4b81-abf0-e07dff1804bd%40googlegroups.com.
--
You received this message because you are subscribed to a topic in the Google Groups "PHP Framework Interoperability Group" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/php-fig/vHDBBb915kM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to php-fig+u...@googlegroups.com.
To post to this group, send email to php...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/php-fig/CAGOJM6%2BGd8PA_VyGuXw7V7_P95tvjcpMR_PBCymyCDfbLU7zng%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/php-fig/CADqTB_jM1kLC78zxXZmwx4dfaNdgVbbixYo59uY%3D_fu8gGUvYw%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/php-fig/CALDVupJx93oELwz0HsJqVdBtjh53bVFssQqHFzLziWC%3DSUzcAw%40mail.gmail.com.
I don't disagree, but what you're also saying then, is that PSR-7 based projects by definition cannot (or at least should not) interop with anything that uses the standard PHP session API.
And since there is no PSR for sessions, bottom line, everyone implements their own, meaning no two components are likely to share the same session management, or at least it would just be luck of they happen to do so ;-)
What upsets me, is that this is WORSE than the situation we had with standard session management - at least we had one cookie, one storage API, and although, granted, it was pretty terrible, at least there was a common way of doing sessions.
So if standard session management dies with PSR-7, that means we need a new standard - so that all these new session implementations can be interoperable.
Right?
Or do we suddenly not care about that anymore for some reason? :-)
--
You received this message because you are subscribed to a topic in the Google Groups "PHP Framework Interoperability Group" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/php-fig/vHDBBb915kM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to php-fig+u...@googlegroups.com.
To post to this group, send email to php...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/php-fig/55C3D215.4050501%40gmail.com.
I don't disagree, but what you're also saying then, is that PSR-7 based projects by definition cannot (or at least should not) interop with anything that uses the standard PHP session API.
The problem with just using PHP sessions (vs rewriting the thing from the ground up) is that, whether you're dispatching it from middleware or not, whether you're using an abstraction or not, the sending of the session ID cookie is outside of the header model.
That affects testing, though as somebody pointed out, that can still be addressed by mocking the abstraction in test, so...
I guess that'll have to do, but I'm really looking forward to that session PSR, so we can do this in a clean, interoperable way, rather than working around that crusty old standard session library ;-)
Is that PSR under way?
You received this message because you are subscribed to a topic in the Google Groups "PHP Framework Interoperability Group" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/php-fig/vHDBBb915kM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to php-fig+u...@googlegroups.com.
To post to this group, send email to php...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/php-fig/CAJp_myWmBPGmWnArTwuAJsZDq%3DUQAFCT-iuybb%2BEnt-bYn8YvQ%40mail.gmail.com.
Is that PSR under way?