Session save handler can't see object reference |
Hi!
I have a very weird issue. I fear it's a PHP itself that fails here but I ran against in in CodeIgniter so someone might have more info on that. I'm using the File session driver. I do the following: Code: $modifiedPerson = clone $_SESSION[ 'user' ]; All is well till the end of the index.php process. But when I put a breakpoint to FileHandler::write() and start debugging, I see $_SESSION[ 'user' ] pointing the original object, not the reassigned clone. PHP 7.2.34 CI 4.0.3 MacOS BigSur 11.6 Apache 2.4.46
I was wrong. It's not only the $_SESSION[ 'user' ] member.
It's the whole $_SESSION[] array that somehow gets reverted to at this moment unknown previous status when in FileHandler::write()
Hi all,
I still can't put my finger on this but I might have some leads. It seems to be related to Filters that start the session and then return redirect. Can anyone think of a scenario where a filter with redirect can mess up a session in the way described above?
Hi again. I believe I've been able to trace the issue down. In fact, I have another post here and I never realized they were connected: https://forum.codeigniter.com/showthread.php?tid=77381
The problem seems to be quite straight forward: when I use redirect(), the session is simply not written (using the FileHandler) - at least not before the redirect request kicks in. And because I have a filter that needs to check the session, it starts it and whatever was added to in in the previous call is lost. Would anyone have a clue how I can get this fixed? |
Welcome Guest, Not a member yet? Register Sign In |