Link: PHP serialization and sessions don't mix

Mar 23, 2012   #php  #serialize  #session 

Today I ran into a problem where my PHP Application would throw this fatal error:

Fatal error: Exception thrown without a stack frame in Unknown on line 0

… After a few minutes I found the problem: I had a class that would save itself to the Session, and that class also had a __sleep method which is invoked on serialization.

I had a similar problem not too long ago. My solution was to call:

<?php
register_shutdown_function('session_write_close');

at the beginning of the bootstrap process.