#24908 [Ver->Csd]: Unexpected $_SESSION value in __destruct function

From: Date: Tue, 27 Jan 2004 21:21:14 +0000
Subject: #24908 [Ver->Csd]: Unexpected $_SESSION value in __destruct function
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-54007@lists.php.net to get a copy of this message
ID: 24908 Updated by: sniper@php.net Reported By: itotakas at msu dot edu -Status: Verified +Status: Closed Bug Type: Zend Engine 2 problem Operating System: * PHP Version: 5CVS-2003-11-29 New Comment: Please try using this CVS snapshot: http://snaps.php.net/php5-latest.tar.gz For Windows: http://snaps.php.net/win32/php5-win32-latest.zip Seems to be fixed. Previous Comments: ------------------------------------------------------------------------ [2003-08-11 14:11:24] helly@php.net Also see #24914 ------------------------------------------------------------------------ [2003-08-10 22:28:15] iliaa@php.net The problem will occur when any super global is used from within __destruct. Here is a simpler example: <?php class test { function __destruct() { print_r($_ENV); } } $test = new test(); ?> ------------------------------------------------------------------------ [2003-08-01 12:33:10] itotakas at msu dot edu Description: ------------ $_SESSION variable should be "array" and "super global". However, within the __destrunct function, $_SESSION changes its value to the reference to the class which implements __destruct function. [Example] <? session_start(); $_SESSION["test"] = "test string"; class test { function __destruct() { // $_SESSION = $this !? print_r($_SESSION); } } $test = new test; ?> [Expected result] Array ( [test] => test string ) [Actual result] test Object ( ) Reproduce code: --------------- <? session_start(); $_SESSION["test"] = "test string"; class test { function __destruct() { // $_SESSION = $this !? print_r($_SESSION); } } $test = new test; ?> Expected result: ---------------- Array ( [test] => test string ) Actual result: -------------- test Object ( ) ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=24908&edit=1

« previous php.bugs (#54007) next »