-
Notifications
You must be signed in to change notification settings - Fork 9
Fixed a situation where for an empty (no data) session, COOKIE was no… #1
Conversation
We need a unit test demonstrating the scenario, and validating the fix, before we can merge this. As it is, this patch causes an existing test to fail; please see https://travis-ci.org/zendframework/zend-expressive-session-ext/jobs/292188417#L615 for details. |
I removed the testPersistSessionReturnsOriginalResposneIfSessionIsEmpty() method from the test. Reason is as follows: If I called session_start (), then the session should be keep regardless of whether there is any data in $_SESSION, or not. |
@batumibiz We also need a test demonstrating the scenario you describe, and validating the changes you are proposing enable that scenario. |
OK, we have a night now, tomorrow I'll do it. |
…fNoSessionCookiePresent()
…rIfSessionHasContents()
Done. Added tests with descriptions in PhpDoc I deleted the testPersistSessionReturnsResponseWithSetCookieHeaderIfSessionHasContents(), because the behavior of the class does not change, regardless of whether there is data in the session, or not. Instead, he added a small test testPersistSessionIfSessionHasContents() that checks the data. |
How is this an error? If there is no session data, should the cookie be set? AFAIK for zend-expressive-session it shouldn't matter if the cookie is sent or not. To be honest, I prefer to not have cookies sent if there is no session data. |
OK, for demonstration, I have made a small example based on the latest versions of components How to see the problem?
You will see that after each page refresh, a new session file is created. |
We just ran into this issue with a Zend\Expressive 3 RC1 application. This PR fixes the issue we have. It took us some hours to track this down. Please accept this PR! Thanks, Ralf |
Fixed a situation where for an empty (no data) session, COOKIE was no…
@batumibiz Thanks for the detailed example and fix! |
The error is visible only on the empty session data, it simply does not install the required COOKIE, if they did not exist. If the session has some data, there is no error.