diff options
author | Paul Arthur <paul.arthur@flowerysong.com> | 2013-05-30 12:45:17 -0400 |
---|---|---|
committer | Paul Arthur <paul.arthur@flowerysong.com> | 2013-05-30 12:55:00 -0400 |
commit | 78d220fbd50452fbb662444edc076730ea6c3d5a (patch) | |
tree | 8108be0053e6fb463d4d1dc52191c635693720a8 /lib/class | |
parent | 94d635d37401de0c747bd34030e08c738dfe0d68 (diff) | |
download | ampache-78d220fbd50452fbb662444edc076730ea6c3d5a.tar.gz ampache-78d220fbd50452fbb662444edc076730ea6c3d5a.tar.bz2 ampache-78d220fbd50452fbb662444edc076730ea6c3d5a.zip |
Register session_write_close shutdown function
http://php.net/manual/en/function.session-set-save-handler.php:
When using objects as session save handlers, it is important
to register the shutdown function with PHP to avoid unexpected
side-effects from the way PHP internally destroys objects on
shutdown and may prevent the write and close from being called.
Typically you should register 'session_write_close' using the
register_shutdown_function() function.
We're not using objects as session save handlers, but some people
(notably, Synology users) seem to be encountering a similar issue
related to the timing of object destruction. Closing the session
earlier in the shutdown process is a perfectly sane thing to do, so
let's do it.
Diffstat (limited to 'lib/class')
-rw-r--r-- | lib/class/session.class.php | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/class/session.class.php b/lib/class/session.class.php index f34b7be7..4a64b199 100644 --- a/lib/class/session.class.php +++ b/lib/class/session.class.php @@ -336,6 +336,10 @@ class Session { array('Session', 'write'), array('Session', 'destroy'), array('Session', 'gc')); + + // Make sure session_write_close is called during the early part of + // shutdown, to avoid issues with object destruction. + register_shutdown_function('session_write_close'); } /** |