|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2006-06-27 13:39 UTC] thomas at ecommerce dot com
[2006-06-28 09:47 UTC] thomas at ecommerce dot com
[2006-06-28 09:57 UTC] thomas at ecommerce dot com
[2006-06-28 13:25 UTC] thomas at ecommerce dot com
[2006-06-28 13:29 UTC] tony2001@php.net
[2006-06-28 13:35 UTC] thomas at ecommerce dot com
[2006-06-30 09:54 UTC] thomas at ecommerce dot com
[2006-07-06 10:20 UTC] thomas at ecommerce dot com
[2006-07-06 10:25 UTC] thomas at ecommerce dot com
[2006-07-06 11:18 UTC] bjori@php.net
[2006-11-07 14:08 UTC] mjwindsorREMOVE at CAPShotmail dot com
[2007-02-24 21:49 UTC] dmytton@php.net
[2007-02-26 09:57 UTC] thomas at ecommerce dot com
[2007-02-26 11:06 UTC] tony2001@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Nov 13 23:00:01 2025 UTC |
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" }