-
Notifications
You must be signed in to change notification settings - Fork 60
Session issue php5.6 #6
Session issue php5.6 #6
Conversation
For some reason FlashMessenger plugin doesn't work on PHP 5.5 and 5.6 storage is never created, isset returns true but $storage[$name] is empty. Tested on Linux Ubuntu 12, 14 and Apache 2.4
@ArchangelDesign could you please add a test that exhibits this behavior so that we can ensure everything is good going forward? |
@ArchangelDesign i would really like to see if we can get this done today as the plan is to release the next version at some point today. |
@ArchangelDesign I have been unable to reproduce this via a unit test thus far, could you share how you are configuring the session? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The isset()
is still necessary, and should be performed before the other checks.
@mwillbanks When writing a test, set the container key in the storage to a scalar, truthy value before attempting to retrieve the container. I think that will display the issue. |
@weierophinney it will, the question is how is it getting to this state... @ArchangelDesign are you manually managing the flash messenger's keys at any certain state? The failure should indeed happen here and as @weierophinney stated it is getting set to a scalar of some kind. In this case the container should actually fail as there is already data present of which it should not automatically remove. I've attempted to look through just about all places of the session code and it does not seem to provide any clues as to what is happening. What I can say is that there might be something where you manually are attempting to manage or clean up a session variable by not leveraging the container but rather setting it to null. |
sorry for the delay, I will test this solution tomorrow at work, however I don't think it will resolve this issue. I do not set messenger's keys manually (although I've tried that figuring out what went wrong) and I do not use session container at any point before in the application. Changing namespace doesn't help either, however session container works perfectly by itself, which points to messenger issue. Test case: the above throws exception of type mismatch. I understand that isset() is required due to the warning issue, but that will leave us with choice to either use customized ZF2 in our project (which I don't like) or to write custom messenger (which my boss doesn't like) :) There is no rush as far as I'm concerned, the fix I applied works fine for now. I should probably mention that this particular application works as a Moodle 2.7 block, thus there might be some overlap, however there has never been an issue with session container before, nor memory manager or cache. I will continue investigation tomorrow and let you know what I found. |
If you can make a reproduceable test case we can get it fixed, my main concern is finding the source of the problem and fixing that vs. fixing the symptom. |
Closing the issue for now; if you find a reproducible test case feel free to open. |
Perhaps issue itself is in FlashMessenger rather than in Session but this change resolves issue on PHP 5.5 and 5.6. For some reason isset returns true but object is empty thus exception is thrown.
Regardless of PHP configuration (session autostart and storage location) this issue is reproducible. Setting storage manually also doesn't help.