#39496 [NEW]: $_SESSION assignment to variable stops register data

From: Date: Mon, 13 Nov 2006 14:01:29 +0000
Subject: #39496 [NEW]: $_SESSION assignment to variable stops register data
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-104907@lists.php.net to get a copy of this message
From: bartek at cpu-zeto dot com dot pl Operating system: Windows XP PHP version: 5.2.0 PHP Bug Type: Session related Bug description: $_SESSION assignment to variable stops register data Description: ------------ If you assign $_SESSION to variable you can't register more data after assignment and it differs even on kind of a variable local or static. If you place assignments between registering data, you can't: 1) to a static varable ex.: self::$var you can't register data after that assignments, 2) to local variable $var=$_SESSION you can't register data before and after. But there is workaround you should assign with casting to array: $var = (array)$_SESSION in both cases. Reproduce code: --------------- // 1 - seperate code $_SESSION["test1"] = "test1"; self::$var = $_SESSION; $_SESSION["test2"] = "test2"; // 2 - seperate code $_SESSION["test1"] = "test1..."; $var = $_SESSION; $_SESSION["test2"] = "test2..."; //workaround $_SESSION["test1"] = "test1..."; $var = (array)$_SESSION; self::$var = (array)$_SESSION; $_SESSION["test2"] = "test2..."; Expected result: ---------------- I expect register data to $_SESSION after assignments $_SESSION to some variable. Actual result: -------------- It's not -- Edit bug report at http://bugs.php.net/?id=39496&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=39496&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=39496&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=39496&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=39496&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=39496&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=39496&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=39496&r=needscript Try newer version: http://bugs.php.net/fix.php?id=39496&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=39496&r=support Expected behavior: http://bugs.php.net/fix.php?id=39496&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=39496&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=39496&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=39496&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=39496&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=39496&r=dst IIS Stability: http://bugs.php.net/fix.php?id=39496&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=39496&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=39496&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=39496&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=39496&r=mysqlcfg

« previous php.bugs (#104907) next »