ID: 39496 Updated by: [EMAIL PROTECTED] Reported By: bartek at cpu-zeto dot com dot pl -Status: Open +Status: Bogus Bug Type: Session related Operating System: Windows XP PHP Version: 5.2.0 New Comment:
Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php . Previous Comments: ------------------------------------------------------------------------ [2006-11-14 02:56:03] judas dot iscariote at gmail dot com This is the expected behaviuor. $_SESSION is a "magical" superglobal. if you attempt to $_SESSION = $var or $var = $_SESSION it will loose it's magical atributes, for your own benefit. It will not let you to shoot yourself in the foot. ------------------------------------------------------------------------ [2006-11-13 14:01:29] bartek at cpu-zeto dot com dot pl 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 this bug report at http://bugs.php.net/?id=39496&edit=1