From:             jaanus at heeringson dot com
Operating system: Linux 2.4.24
PHP version:      5CVS-2004-03-10 (dev)
PHP Bug Type:     Session related
Bug description:  Unable to modify $_SESSION from __destruct()

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 bug report at http://bugs.php.net/?id=27555&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=27555&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=27555&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=27555&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=27555&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=27555&r=needtrace
Need Reproduce Script:      http://bugs.php.net/fix.php?id=27555&r=needscript
Try newer version:          http://bugs.php.net/fix.php?id=27555&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=27555&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=27555&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=27555&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=27555&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=27555&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=27555&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=27555&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=27555&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=27555&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=27555&r=float

Reply via email to