ID:               37926
 Updated by:       [EMAIL PROTECTED]
 Reported By:      thomas at ecommerce dot com
-Status:           Open
+Status:           Bogus
 Bug Type:         Session related
 Operating System: SuSE Linux 10.0
 PHP Version:      5.1.4
 New Comment:

>Can i get a status update on this bug?
Yes. Don't try to outsmart session extension by changing $_SESSION
array itself. This way $_SESSION looses its magical features and the
only result you can get is invalid/broken data.
This is expected and I have serious doubts it's going to be changed
ever.


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

[2006-06-28 13:25:21] thomas at ecommerce dot com

Can i get a status update on this bug?

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

[2006-06-28 09:57:13] thomas at ecommerce dot com

Here is also an interesting issue:

When i use the 2nd example code ( the one with $tmp = $_SESSION);

and i put

unset($tmp);

after it or try to assign 
$tmp['x'] = 'y';

then the $_SESSION assignment startin again to work. Please
investigatte ASAP.

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

[2006-06-28 09:47:34] thomas at ecommerce dot com

Same problem with this Code example:

<?php
ob_Start();
session_start();

var_dump($_SESSION);

$_SESSION['asdf'] = "cool";

$tmp = $_SESSION;

$cool = 'test';

$_SESSION['me'] = $cool;

var_dump($_SESSION);

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

[2006-06-27 13:39:04] thomas at ecommerce dot com

wrong subject

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

[2006-06-27 13:38:25] thomas at ecommerce dot com

Description:
------------
I didn't find anything in the documentation that is related to the
following script. Its not possible to update the $_SESSION var after
the call 'dummy($_SESSION)'.

The var will be set during the runtime, but when you refresh the
page/script, the vars setted after the function call will be gone.

just put the bottom code in an test.php script and run it 1 time and
refresh it again via browser. You will see, second var will be gone
after refresh.

Reproduce code:
---------------
<?php
ob_start(); //-- enshure headers don't get sended
session_start(); //-- start session

//-- dummy function, that make it impossible to set an $_SESSION var
after it
function dummy($var = null)
{
    static $tmp = array();

    $tmp[] = $var;
}

//-- dump current value
var_dump($_SESSION);

//-- set new value
$_SESSION['test'] = "cool";

//-- call dummy function
dummy($_SESSION);

//-- simeple var
$cool = "yes";

//-- set var in session
$_SESSION['whatever'] = $cool;

//-- dump current value
var_dump($_SESSION);

?>

Expected result:
----------------
Expected result after refresh:

array(2) {
  ["test"]=>
  string(4) "cool"
  ["whatever"]=>
  string(3) "yes"
}
array(2) {
  ["test"]=>
  string(4) "cool"
  ["whatever"]=>
  string(3) "yes"
}

Actual result:
--------------
Current result after refresh:

array(1) {
  ["test"]=>
  string(4) "cool"
}
array(2) {
  ["test"]=>
  string(4) "cool"
  ["whatever"]=>
  string(3) "yes"
}


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


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

Reply via email to