#36239 [NEW]: $_SESSION Array Assignment Fails

From: Date: Wed, 01 Feb 2006 04:37:53 +0000
Subject: #36239 [NEW]: $_SESSION Array Assignment Fails
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-92740@lists.php.net to get a copy of this message
From: martin at itmission dot com Operating system: Windows PHP version: 5.1.2 PHP Bug Type: Session related Bug description: $_SESSION Array Assignment Fails Description: ------------ $_SESSION does not keep results when assigned an array variable. Reproduce code: --------------- test1.php <?php session_start(); echo("<a href=\"{$_SERVER['PHP_SELF']}\">click</a>"); print_r($_SESSION); $_SESSION = array('id' => 1, 'user' => 'test'); session_write_close(); ?> test2.php <?php session_start(); echo("<a href=\"{$_SERVER['PHP_SELF']}\">click</a>"); print_r($_SESSION); $row = array('id' => 1, 'user' => 'test'); $_SESSION = $row; session_write_close(); ?> test3.php <?php session_start(); echo("<a href=\"{$_SERVER['PHP_SELF']}\">click</a>"); print_r($_SESSION); $row = array('id' => 1, 'user' => 'test'); $_SESSION = $row + array(); session_write_close(); ?> Expected result: ---------------- Test1.php: Works Test2.php: Fails Test3.php: Works Actual result: -------------- Test1: clickArray ( [id] => 1 [user] => test ) Test2: clickArray ( ) Test3: clickArray ( [id] => 1 [user] => test ) -- Edit bug report at http://bugs.php.net/?id=36239&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=36239&r=trysnapshot44 Try a CVS snapshot (PHP 5.1): http://bugs.php.net/fix.php?id=36239&r=trysnapshot51 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=36239&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=36239&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=36239&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=36239&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=36239&r=needscript Try newer version: http://bugs.php.net/fix.php?id=36239&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=36239&r=support Expected behavior: http://bugs.php.net/fix.php?id=36239&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=36239&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=36239&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=36239&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=36239&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=36239&r=dst IIS Stability: http://bugs.php.net/fix.php?id=36239&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=36239&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=36239&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=36239&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=36239&r=mysqlcfg

« previous php.bugs (#92740) next »