ID: 34542 Comment by: uap-php at cheeky dot org Reported By: marcus dot uy at virtualthinking dot com Status: Feedback Bug Type: Session related Operating System: WinXP Pro PHP Version: 5.1.0RC4 New Comment:
Hello, Having similar problems on 5.0.5. Basically all I can say is, if you have register_long_arrays=Off in your ini file, $_SESSION stuff does work, apart from when you iterate over it. Run the code below, with register_long_arrays=On and then with it off. The final result will be different. It seems that if you iterate over $_SESSION, the session_save handler does not get called and the session data is not saved. Hope this sheds some light on the problem, <?php session_start(); switch ($_REQUEST['state']) { case 3: $step='"search_test" should still be empty.'; $refresh=''; break; case 2: foreach($_SESSION as $key=>$value){ $_SESSION[$key]=''; } $step='empty session "search_test"'; $refresh='<META HTTP-EQUIV="Refresh" CONTENT="3;'.$_SERVER["PHP_SELF"].'?state=3&'.date("U").'">'; break; case 1: $step='nothing set in this step'; $refresh='<META HTTP-EQUIV="Refresh" CONTENT="3;'.$_SERVER["PHP_SELF"].'?state=2&'.date("U").'">'; break; default: $_SESSION['search_test'] = 'Hello!'; $step='set session "search_test" to "Hello"'; $refresh='<META HTTP-EQUIV="Refresh" CONTENT="3;'.$_SERVER["PHP_SELF"].'?state=1&'.date("U").'">'; } ?> <html><head><?=$refresh?></head></body> <?php echo $step.'<br /><br />Session Data:<hr/><pre>'; print_r($_SESSION); echo '</pre>'; ?> </body></html> Previous Comments: ------------------------------------------------------------------------ [2005-11-09 23:43:51] mail at lenzw dot de see Bug #33811 for a reproduction code. ------------------------------------------------------------------------ [2005-11-03 22:10:18] [EMAIL PROTECTED] Thank you for this bug report. To properly diagnose the problem, we need a short but complete example script to be able to reproduce this bug ourselves. A proper reproducing script starts with <?php and ends with ?>, is max. 10-20 lines long and does not require any external resources such as databases, etc. If possible, make the script source available online and provide an URL to it here. Try to avoid embedding huge scripts into the report. ------------------------------------------------------------------------ [2005-11-03 16:47:25] marcus dot uy at virtualthinking dot com Hi, I think somebody else has a related problem with a workable test case. ------------------------------------------------------------------------ [2005-11-03 09:36:44] marcus at synchromedia dot co dot uk I think I'm seeing this same bug in 5.1.0RC4. I'm not getting exactly the same symptom, but it's close. I'm finding that session files are created no problem, but when I change values in $_SESSION, the changes are not saved, even if I use session_write_close(). I've set up a small test case that is storing and changing exactly what I'm doing in my project and it doesn't happen, so I don't think it's a problem with the contents of the session. I also wrote a test that stuffed 5000 strings into $_SESSION and that worked ok too. Like the original bug report, it all works fine if I leave register_long_arrays turned on, even though I'm not using them anywhere in my code, or in libraries that I'm using. What I would like to do is do a trace with xdebug and look at everything that involves sessions, but I can't at present because xdebug-cvs won't run under 5.1.0RC4. ------------------------------------------------------------------------ [2005-09-19 13:47:45] [EMAIL PROTECTED] Thank you for this bug report. To properly diagnose the problem, we need a short but complete example script to be able to reproduce this bug ourselves. A proper reproducing script starts with <?php and ends with ?>, is max. 10-20 lines long and does not require any external resources such as databases, etc. If possible, make the script source available online and provide an URL to it here. Try to avoid embedding huge scripts into the report. ------------------------------------------------------------------------ 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/34542 -- Edit this bug report at http://bugs.php.net/?id=34542&edit=1