ID:               32886
 Updated by:       [EMAIL PROTECTED]
 Reported By:      luis at infomed dot sld dot cu
-Status:           Bogus
+Status:           Open
 Bug Type:         Session related
-Operating System: Linux & Windows
+Operating System: *
 PHP Version:      5.0.4


Previous Comments:
------------------------------------------------------------------------

[2005-04-29 09:08:10] [EMAIL PROTECTED]

Not a bug. If you overwrite the $_SESSION array by assigning a new
array to it, you remove it's magic properties of being the array with
session variables. This is expected - so don't do it.

------------------------------------------------------------------------

[2005-04-29 08:45:16] luis at infomed dot sld dot cu

Description:
------------
php5.0.4 dont store the correct values after modified the $_SESSION
variable, the idea is to clear the session and do persist only a few
values. I use Apache 1.3.33. With php5.0.2 everything is fine the
problem appear with php5.0.4, I am not try with php5.0.3


Reproduce code:
---------------
page1.php-----------------------------------------

<?php
session_start();
$_SESSION['varA'] = 'aaa';
$_SESSION['varB'] = 'bbb';
?>

page2.php-----------------------------------------

<?php
session_start();
$buffer['varA'] = $_SESSION['varA'];
$_SESSION = array();
$_SESSION = $buffer;
print_r($_SESSION);
?>

page2b.php-----------------------------------------

<?php
session_start();
$_SESSION = array();
$_SESSION['varA'] = 'aaa';
print_r($_SESSION);
?>

page3.php-----------------------------------------

<?php
session_start();
print_r($_SESSION);
?>


Expected result:
----------------
I would expect the same behavior with:
page1.php->page2.php->page3.php
and with:
page1.php->page2b.php->page3.php
but is not.


Actual result:
--------------
When I do page1.php->page2.php on the screen I obtain the correct
values:
Array ( [varA] => aaa )
but on the session file in disc is wrong, because the session file
have:
varA|s:3:"aaa";varB|s:3:"bbb";
and in page3.php on the screen I have:
Array ( [varA] => aaa [varB] => bbb ), is wrong.

But, if I do page1.php->page2b.php->page3.php everything is fine.

Thank you for your work in PHP.



------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=32886&edit=1

Reply via email to