I am experiencing issue with a session being destroyed out of nowhere:
session_start(): Failed to decode session object. Session has been destroyed
.
Kind of impossible to replicate the issue since I got this thrown in my server log.
Any ideas what could be the roots of that problem and/or where to start because I am getting that very rare (almost never).
So I experienced this after migrating from Lighttpd webserver, PHP 5.6 to Nginx webserver, PHP 7.2, and at first it seamed so random, however, I was able to notice that this issue is user specific, where some of the users where able to login normally, but the server was not able to provide data from the session, so I checked
read
function in the custom session class and checked what data it was trying toserialize()
and return, by usingunset()
I removed anything that I thought was not useful for the application to run beforeserialize()
and return, and that seams to have solved the problem.So the problem is either one or both:
for more on the
read
function: https://www.php.net/manual/en/function.session-set-save-handler.php