From:             maxtjh at hotmail dot com
Operating system: Windox XP SP2
PHP version:      5.2.10
PHP Bug Type:     Session related
Bug description:  Assign $_SESSION to an empty array doesn't work

Description:
------------
Output for Test.php

Current SID: 1e2rcu3s63pv5r0m0omuckmmc6
$_SESSION => array(0) { }
--------------------------------------…


Output for Test.php?set=1

Current SID: 1e2rcu3s63pv5r0m0omuckmmc6
Session has been set with 'a' and 'b'
$_SESSION => array(2) { ["a"]=> string(3) "aaa" ["b"]=> string(3) "bbb" }
--------------------------------------…


Output for Test.php?reset=1

Current SID: 1e2rcu3s63pv5r0m0omuckmmc6
Session has been set with empty array and new SID is regenerated.
New sid: hathl18bl00gedoqeia2q6dq36
$_SESSION => array(0) { }
--------------------------------------…

After go throught these 3 URL, $_SESSION should be equal to empty array
before regenarate new session id.

But it get wrong here:
Change current session id (hathl18bl00gedoqeia2q6dq36) with old session id
(1e2rcu3s63pv5r0m0omuckmmc6) in cookie and enter Test.php without any get
method.

$_SESSION should be an empty array but it show this:

Current SID: 1e2rcu3s63pv5r0m0omuckmmc6
$_SESSION => array(2) { ["a"]=> string(3) "aaa" ["b"]=> string(3) "bbb" }

Reproduce code:
---------------
session_start();
echo 'Current SID: '.session_id().'<br/>';
if(isset($_GET['set']))
{       $_SESSION=array('a'=>'aaa','b'=>'bbb');
        echo 'Session has been set with \'a\' and \'b\''.'<br/>';
}

if(isset($_GET['reset']))
{       $_SESSION=array();
        session_regenerate_id();
        echo 'Session has been set with empty array and new SID is
regenerated.'.'<br/>';
        echo 'New sid: '.session_id().'<br/>';
}

echo '$_SESSION => ';
echo var_dump($_SESSION).'<br/>';

Expected result:
----------------
Current SID: 1e2rcu3s63pv5r0m0omuckmmc6
$_SESSION => array(0) { }

Actual result:
--------------
Current SID: 1e2rcu3s63pv5r0m0omuckmmc6
$_SESSION => array(2) { ["a"]=> string(3) "aaa" ["b"]=> string(3) "bbb" }

-- 
Edit bug report at http://bugs.php.net/?id=49557&edit=1
-- 
Try a snapshot (PHP 5.2):            
http://bugs.php.net/fix.php?id=49557&r=trysnapshot52
Try a snapshot (PHP 5.3):            
http://bugs.php.net/fix.php?id=49557&r=trysnapshot53
Try a snapshot (PHP 6.0):            
http://bugs.php.net/fix.php?id=49557&r=trysnapshot60
Fixed in SVN:                        
http://bugs.php.net/fix.php?id=49557&r=fixed
Fixed in SVN and need be documented: 
http://bugs.php.net/fix.php?id=49557&r=needdocs
Fixed in release:                    
http://bugs.php.net/fix.php?id=49557&r=alreadyfixed
Need backtrace:                      
http://bugs.php.net/fix.php?id=49557&r=needtrace
Need Reproduce Script:               
http://bugs.php.net/fix.php?id=49557&r=needscript
Try newer version:                   
http://bugs.php.net/fix.php?id=49557&r=oldversion
Not developer issue:                 
http://bugs.php.net/fix.php?id=49557&r=support
Expected behavior:                   
http://bugs.php.net/fix.php?id=49557&r=notwrong
Not enough info:                     
http://bugs.php.net/fix.php?id=49557&r=notenoughinfo
Submitted twice:                     
http://bugs.php.net/fix.php?id=49557&r=submittedtwice
register_globals:                    
http://bugs.php.net/fix.php?id=49557&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=49557&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=49557&r=dst
IIS Stability:                       
http://bugs.php.net/fix.php?id=49557&r=isapi
Install GNU Sed:                     
http://bugs.php.net/fix.php?id=49557&r=gnused
Floating point limitations:          
http://bugs.php.net/fix.php?id=49557&r=float
No Zend Extensions:                  
http://bugs.php.net/fix.php?id=49557&r=nozend
MySQL Configuration Error:           
http://bugs.php.net/fix.php?id=49557&r=mysqlcfg

Reply via email to