Welcome Guest, Not a member yet? Register   Sign In
Time objects can break session
#1

Hi,
I can't guarantee this is always the case but certainly happens most of the time. When I save an Entity object to the SESSION and at least one of the attributes is a Time object, the next session_start() throws an exception.
Reply
#2

What is the exception message?
Reply
#3

(This post was last modified: 02-11-2022, 09:41 AM by Jan Zelenka.)

Error
Invalid serialization data for DateTime object
SYSTEMPATH/Session/Session.php at line 1005

Code:
998         if (ENVIRONMENT === 'testing')
999         {
1000             $_SESSION = [];
1001             return;
1002         }
1003
1004         // @codeCoverageIgnoreStart
1005         session_start();
1006         // @codeCoverageIgnoreEnd
1007     }
1008
1009     //--------------------------------------------------------------------
1010
1011     /**
1012      * Takes care of setting the cookie on the client side.

Now this is puzzling. I found this fix:
https://github.com/codeigniter4/CodeIgni...78b1bdc1b3
But when I look at the current code on GitHub, Time::__wakeup() is not there. I added this function to my version of the Time class and so far it seems to be working fine.
Reply
#4

Time::__wakeup() is there.
https://github.com/codeigniter4/CodeIgni....php#L1173
Reply
#5

Seems your version is not updated.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB