Skip to content

Commit

Permalink
! fix #1023, APC destroys static class members before sessions can be…
Browse files Browse the repository at this point in the history
… written

Signed-off-by: Spuds <spuds@spudsdesign.com>
  • Loading branch information
Spuds committed Mar 28, 2014
1 parent 05ccffe commit 03a5778
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion sources/Session.php
Expand Up @@ -27,7 +27,7 @@
*/
function loadSession()
{
global $modSettings, $boardurl, $sc;
global $modSettings, $boardurl, $sc, $cache_accelerator;

// Attempt to change a few PHP settings.
@ini_set('session.use_cookies', true);
Expand Down Expand Up @@ -84,8 +84,14 @@ function loadSession()
eaccelerator_set_session_handlers();
}

// Start the session
session_start();

// APC destroys static class members before sessions can be written. To work around this we
// explicitly call session_write_close on script end/exit bugs.php.net/bug.php?id=60657
if (!empty($modSettings['cache_enable']) && $cache_accelerator === 'apc')
register_shutdown_function('session_write_close');

// Change it so the cache settings are a little looser than default.
if (!empty($modSettings['databaseSession_loose']))
header('Cache-Control: private');
Expand Down

0 comments on commit 03a5778

Please sign in to comment.