ID: 35479 Updated by: [EMAIL PROTECTED] Reported By: kenashkov at gmail dot com -Status: Open +Status: Wont fix Bug Type: Session related Operating System: Fedora Core 4 PHP Version: 4.4.1 New Comment:
It's fine as it is. Changing this now would break backwards compatibility. Previous Comments: ------------------------------------------------------------------------ [2005-11-29 18:15:55] kenashkov at gmail dot com Description: ------------ Let suppose that we use the session_set_save_handler to register own session handling functions and we have an expired session (but not cleaned by the garbage collector yet). When we start the session with session_start() we get the following sequence of calling the registered functions: open read gc write close I think the garbage collector (gc) should be called BEFORE the read function (in order to clean that expired session beofre it is read). In the way it is, is possible for the web site visitor to use an old session (only once of course, because immediately after read is called gc and for the second visit the session will be already deleted). Maybe the same problem exists when is not used the session_set_save_handler, but with it the sequence can be seen. Reproduce code: --------------- <? function open() { print 'open<br>'.PHP_EOL; return true; } function close() { print 'close<br>'.PHP_EOL; return true; } function read() { print 'read<br>'.PHP_EOL; return ''; } function write() { print 'write<br>'.PHP_EOL; return true; } function destroy() { print 'destroy<br>'.PHP_EOL; return true; } function gc() { print 'gc<br>'.PHP_EOL; return true; } ini_set('session.gc_probability',1); ini_set('session.gc_divisor',1); session_set_save_handler('open','close','read','write','destroy','gc'); session_start(); session_write_close(); ?> Expected result: ---------------- open gc read write close Actual result: -------------- open read gc write close ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=35479&edit=1