Edit report at https://bugs.php.net/bug.php?id=60657&edit=1
ID: 60657 Updated by: ar...@php.net Reported by: astewart at online-buddies dot com Summary: APC destroys static class members before sessions are written -Status: Open +Status: Wont fix Type: Bug Package: Session related Operating System: MacOS X 10.7, CentOS 5.6 PHP Version: 5.3.8 Block user comment: N Private report: N New Comment: You should be able to work around this with register_shutdown_function('session_write_close'), or if using a class like in gedrox's example and PHP >= 5.4 you can make it implement SessionHandlerInterface and just call session_set_save_handler($session) which should also take care of this. I'm afraid it's a chicken and egg problem and if the above workarounds don't work either then I don't see a practical solution. Previous Comments: ------------------------------------------------------------------------ [2012-03-02 11:47:51] gedrox at gmail dot com This is actual in 5.3.10 as well. Simple code to reproduce (will log fatal errors about undefined class constant 'logging'): <?php $session = new XSession(); session_set_save_handler(array($session, 'open'), array($session, 'close'), array($session, 'read'), array($session, 'write'), array($session, 'destroy'), array($session, 'gc')); session_start(); class XSession { const logging = false; function open() {if (self::logging) echo 'OK';} function write() {if (self::logging) echo 'OK';} function read() {if (self::logging) echo 'OK';} function close() {if (self::logging) echo 'OK';} function destroy() {if (self::logging) echo 'OK';} function gc() {if (self::logging) echo 'OK';} } ------------------------------------------------------------------------ [2012-01-04 17:25:18] astewart at online-buddies dot com Description: ------------ Like #59564. Neither of the workarounds in that work for us: session is compiled in statically, but APC is a module, so we can't reorder them relative to each other, and an append doesn't work, and doesn't work with scripts that call exit() ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=60657&edit=1