|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #19740 session_write_close() not passing new session vars when globals are turned off
Submitted: 2002-10-03 13:56 UTC Modified: 2002-10-20 23:32 UTC
From: shudson at crackerbarrel dot com Assigned:
Status: No Feedback Package: Session related
PHP Version: 4.2.3 OS: Red Hat Linux 7.3
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
Solve the problem:
22 - 9 = ?
Subscribe to this entry?

 [2002-10-03 13:56 UTC] shudson at crackerbarrel dot com
OS - Red Hat 7.3
Web Server- Apache 1.3.23
PHP - 4.2.3

If globals are turned off when calling session_write_close() before a page redirect, any new session data is not getting written when using files. As a work around, if I use my on session handlers, I ignore the session_data that gets passed to my session_write function and create my own session data string like this:

function sess_write($key, $val)
	// SGH - 10/03/2002
	// globals off bug work around!!! The session data
	// passed in is not always updated with new values.
	// so we'll build our on session data from the
	// super global $_SESSION.
	$sesson_data = "";
	while (list($name, $value) = each($_SESSION))
	   $$name = $value['tmp_name'];

	   if (is_string($value))
	   	$session_data .= $name.'|s:'.strlen($value).':'.chr(34).$value.chr(34).";";
	   elseif (is_int($value))
	   	$session_data .= $name.'|i:'.$value.";";
	   elseif (is_float($value))
			$session_data .= $name.'|d:'.$value.";";
   $val = $session_data;

// more code ............

This works, however, seems to point to a PHP bug, since $val does not contain the new varibles until I set it to the string I created from the super global $_SESSION.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2002-10-03 19:34 UTC]
Please try using this CVS snapshot:
For Windows:
 [2002-10-20 23:32 UTC]
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.

PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Apr 24 22:01:30 2024 UTC