ID: 19022 Comment by: [EMAIL PROTECTED] Reported By: [EMAIL PROTECTED] Status: No Feedback Bug Type: Session related Operating System: linux (rh7.3), apache 1.3.26 PHP Version: 4.2.2 New Comment:
Hello, I am also experiencing this bug. I am using Debian, 2.4.18 kernel, SMP machine, PHP 4.2.3. (also observed bug on PHP 4.1.2). The server is not experiencing a heavy load. I am attempting to script a temporary fix for this bug until there is a permanent fix in a stable PHP release. Would something like the following work? 1. At the end of every page request, backup the session file: copy(session_save_path() . '/sess_' . session_id(), session_save_path() . '/sess_' . session_id() . '_bak'); 2. At the top of each script that requires session data, check to see if the main session file has been truncated. If so, replace it with the backup that you have created. Assuming you have the session Id stored in a cookie as 'user_sess_id': if (isset($_COOKIE[user_sess_id]) && file_exists(session_save_path() . '/sess_' . $_COOKIE[user_sess_id] . '_bak') && file_exists(session_save_path() . '/sess_' . $_COOKIE[user_sess_id]) && (filesize(session_save_path() . '/sess_' . $_COOKIE[user_sess_id]) == 0) && (filesize(session_save_path() . '/sess_' . $_COOKIE[user_sess_id] . '_bak') > 0) ) { // restore the session file copy(session_save_path() . '/sess_' . $_COOKIE[user_sess_id] . '_bak', session_save_path() . '/sess_' . $_COOKIE[user_sess_id]); } // continue with script... Does this have any hope of helping restore the lost session data? Or would PHP have already read in the session data from the file on disk before it reaches this point of processing the code? Any advice on how PHP coders can write a temporary fix for this bug would be greatly appreciated. Thanks, Taylor Davis Previous Comments: ------------------------------------------------------------------------ [2002-10-14 19:26:52] [EMAIL PROTECTED] No feedback was provided for this bug for over a month, so it is being suspended automatically. If you are able to provide the information that was originally requested, please do so and change the status of the bug back to "Open". ------------------------------------------------------------------------ [2002-09-26 12:08:25] [EMAIL PROTECTED] Please try using this CVS snapshot: http://snaps.php.net/php4-latest.tar.gz For Windows: http://snaps.php.net/win32/php4-win32-latest.zip ------------------------------------------------------------------------ [2002-09-18 06:52:29] [EMAIL PROTECTED] hi, sorry been quite busy lately. I upgraded to php4.2.3 today .. still the same problem. I hope i'll have some time to test a actual snapshot today/tommorrow. testing on production server sucks, but the problem itself is even worse. stay tuned, thomas ------------------------------------------------------------------------ [2002-09-06 04:39:27] [EMAIL PROTECTED] Trying snapshots isn't an option on production servers.. ------------------------------------------------------------------------ [2002-09-04 23:22:10] [EMAIL PROTECTED] Then shush up and test a snapshot please :) ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/19022 -- Edit this bug report at http://bugs.php.net/?id=19022&edit=1