Closed azjezz closed 6 years ago
ping @weierophinney
Plain and simple, the ext-session adapter does not work with Swoole. I have suspicions why, but cannot point to a specific reason at this time. Regardless, it doesn't work, and likely any solution using ext-session never will.
I've created a zend-expressive-session adapter that uses a psr-6 cache pool, and have had success using it under swoole; I'll try to publish it in the coming week.
On Thu, Oct 4, 2018, 5:54 PM azjezz notifications@github.com wrote:
ping @weierophinney https://github.com/weierophinney
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/zendframework/zend-expressive-session-ext/issues/27#issuecomment-427195116, or mute the thread https://github.com/notifications/unsubscribe-auth/AABlVxO5O8iiwulCeUw4JKbJuQvWTNgTks5uhpGygaJpZM4XJLbd .
On Oct 4, 2018 5:54 PM, "azjezz" notifications@github.com wrote:
ping @weierophinney https://github.com/weierophinney
— You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub https://github.com/zendframework/zend-expressive-session-ext/issues/27#issuecomment-427195116, or mute the thread https://github.com/notifications/unsubscribe-auth/AABlVxO5O8iiwulCeUw4JKbJuQvWTNgTks5uhpGygaJpZM4XJLbd .
thanks for clarifying @weierophinney , i have just finished my validus/cache package, does your session persistence accept any psr6/psr16 implementation or does it include one that it uses ?
It accepts any psr-6 implementation; I used cache/predis-adapter with mine.
I specifically used psr-6 and not psr-16, as it covers TTL, which is a requirement for sessions as they need to expire.
On Fri, Oct 5, 2018, 8:17 PM azjezz notifications@github.com wrote:
thanks for clarifying @weierophinney https://github.com/weierophinney , i have just finished my validus/cache https://github.com/ValidusPHP/cache package, does your session persistence accept any psr6/psr16 implementation or does it include one that it uses ?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/zendframework/zend-expressive-session-ext/issues/27#issuecomment-427535170, or mute the thread https://github.com/notifications/unsubscribe-auth/AABlV3GAkETKVDId4BhJVNCG9vR1NJMgks5uiASfgaJpZM4XJLbd .
@weierophinney i had nothing to do today, and i needed sessions to continue working on my application so i made something similar to what you are working on, its missing some features ( cookies options, session regeneration .. etc ), but i'll be using it until the PSR16 session persistence is ready.
https://gist.github.com/azjezz/8a32d87df39422a12e3078a35a8c988a
one thing i noticed while doing this ( took me almost 2 hours to track it down ) is that the request is missing 'Cookie' header, so i had to obtain the session cookie from the cookies parameters : $request->getCookieParams();
, is that normal ?
Yes - swoole puts cookies into a special request property and removes the header. The normal place to look for cookies in psr-7 server-side requests is the cookie params, so that's where we place it when marshalling the request.
On Sun, Oct 7, 2018, 6:14 PM azjezz notifications@github.com wrote:
@weierophinney https://github.com/weierophinney i had nothing to do today, and i needed sessions to continue working on my application so i made something similar to what you are working on, its missing some features ( cookies options, cache .. etc ), but i'll be using it until the PSR16 session persistence is ready.
https://gist.github.com/azjezz/8a32d87df39422a12e3078a35a8c988a
one thing i noticed while doing this ( took me almost 2 hours to track it down ) is that the request is missing 'Cookie' header, so i had to obtain the session cookies from the cookies parameters : $request->getCookieParams();, is that normal ?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/zendframework/zend-expressive-session-ext/issues/27#issuecomment-427695408, or mute the thread https://github.com/notifications/unsubscribe-auth/AABlV6SeIW3kyvJWlupAzY5axF5qbV4Uks5uioq7gaJpZM4XJLbd .
@weierophinney i guess that's 1 reason why this package is not compatible with swoole then.
@azjezz Can you explain why you think this package is not compatible with Swoole?
@azjezz and @froschdesign — The reason this package isn't compatible with swoole is because Swoole runs in the CLI, and the CLI SAPI doesn't work with ext-session. It has nothing to do with where cookie information is found in the request instance.
Part of the reason we introduced zend-expressive-session in the first place is because we already knew that ext-session would not be a viable way to handle sessions when you run Expressive in non-traditional environments. At the time, it was due to experiments with ReactPHP, but that experience could be extrapolated to Icicle, Swoole, etc. This was the reason we ensured that zend-expressive-session could work directly with a PSR-7 request only. Now we just need to introduce adapters that do not use ext-session to demonstrate this feature. As I've noted previously in the thread, I've created one for myself that uses PSR-6, and I'll try and get it posted in the next couple days.
this issue should be closed as this package is not compatible with swoole.
a new session persistence has been release which support swoole that makes use of PSR-6 cache. zendframework/zend-expressive-session-cache i have made a package that provides container factories for symfony/cache which is compatible with PSR-6 and zend component installer that you can use. validus/cache
the library works as it supposed to using Apache, nginx or PHP built-in web-server, but that's not the case with swoole (
zendframework/zend-expressive-swoole
), i don't know how am i supposed to start the session or if this library is not compatible with swoole maybe?composer requirements :
This is the logged exception :
Expected results
Actual results
Zend\Stratigility\Middleware\ErrorHandler
middleware