From:             [EMAIL PROTECTED]
Operating system: Red Hat Linux 7.3
PHP version:      4.2.3
PHP Bug Type:     Session related
Bug description:  session_write_close() not passing new session vars when globals are 
turned off

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.
-- 
Edit bug report at http://bugs.php.net/?id=19740&edit=1
-- 
Try a CVS snapshot:         http://bugs.php.net/fix.php?id=19740&r=trysnapshot
Fixed in CVS:               http://bugs.php.net/fix.php?id=19740&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=19740&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=19740&r=needtrace
Try newer version:          http://bugs.php.net/fix.php?id=19740&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=19740&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=19740&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=19740&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=19740&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=19740&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=19740&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=19740&r=dst

Reply via email to