ID: 27555
Updated by: [EMAIL PROTECTED]
Reported By: jaanus at heeringson dot com
-Status: Open
+Status: Bogus
Bug Type: Session related
Operating System: Linux 2.4.24
PHP Version: 5CVS-2004-03-10 (dev)
New Comment:
If you put something like "echo 'this happens now';" line in the
__destruct() call you will see that it's executed AFTER your print_r()
line. This is correct behaviour.
Previous Comments:
------------------------------------------------------------------------
[2004-03-10 18:42:06] jaanus at heeringson dot com
Description:
------------
Unable to add session variables from the __destruct() handler in a
class. The $_SESSION variable can be accessed and viewed in the
__destruct() handler though.
Reproduce code:
---------------
<pre>
<?php
session_start();
class test{
public function __destruct(){
$_SESSION['destructor']='Yes';
}
}
$class=new test();
if(empty($_SESSION['working'])) {
$_SESSION['working']='Yes';
print("New session?\n");
}
print_r($_SESSION);
?>
</pre>
Expected result:
----------------
Array
(
[destructor] => Yes
[working] => Yes
)
Actual result:
--------------
Array
(
[working] => Yes
)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=27555&edit=1