#37926 [Opn]: Session var don't get setted

From: Date: Wed, 28 Jun 2006 09:57:13 +0000
Subject: #37926 [Opn]: Session var don't get setted
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-98888@lists.php.net to get a copy of this message
ID: 37926 User updated by: thomas at ecommerce dot com Reported By: thomas at ecommerce dot com Status: Open Bug Type: Session related Operating System: SuSE Linux 10.0 PHP Version: 5.1.4 New Comment: 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. Previous Comments: ------------------------------------------------------------------------ [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

« previous php.bugs (#98888) next »