Time objects can break session - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28) +--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30) +--- Thread: Time objects can break session (/showthread.php?tid=81262) |
Time objects can break session - Jan Zelenka - 02-11-2022 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. RE: Time objects can break session - paulbalandan - 02-11-2022 What is the exception message? RE: Time objects can break session - Jan Zelenka - 02-11-2022 Error Invalid serialization data for DateTime object SYSTEMPATH/Session/Session.php at line 1005 Code: 998 if (ENVIRONMENT === 'testing') Now this is puzzling. I found this fix: https://github.com/codeigniter4/CodeIgniter4/pull/3557/files/bc751c3fb58886a310cfd4ee4ba8e078b1bdc1b3 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. RE: Time objects can break session - kenjis - 02-11-2022 Time::__wakeup() is there. https://github.com/codeigniter4/CodeIgniter4/blob/90eef161c1e7cb4af6165dfa87e8d4be074092fa/system/I18n/Time.php#L1173 RE: Time objects can break session - paulbalandan - 02-11-2022 Seems your version is not updated. |