#30536 [NEW]: Can't write to $_SESSION in the __destructor()
| From: | deyv at php dot pl | Date: | Fri, 22 Oct 2004 19:52:00 +0000 |
| Subject: | #30536 [NEW]: Can't write to $_SESSION in the __destructor() | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-67969@lists.php.net to get a copy of this message | ||
From: deyv at php dot pl
Operating system: windows + linux
PHP version: 5.0.2
PHP Bug Type: Session related
Bug description: Can't write to $_SESSION in the __destructor()
Description:
------------
In the __destructor all changes in the
$_SESSION array was not saved.
In the php 5.1 it's work corectly.
Reproduce code:
---------------
session_start();
class test
{
function __construct()
{
echo '<br />__construct <br />';
var_dump( $_SESSION );
if( empty( $_SESSION['iForConstruct'] ) )
{
$_SESSION['iForConstruct'] = 1;
$_SESSION['iForDestruct'] = 1;
}
$_SESSION['iForConstruct']++;
}
function __destruct()
{
echo '<br />__destruct';
$_SESSION['iForDestruct'] ++;
}
}
$test = new test();
Expected result:
----------------
In the all refresh we expect incrementing the values of
$_SESSION['iForConstruct'] and $_SESSION['iForDestruct']
for all refresh's
Actual result:
--------------
incrementing only $_SESSION['iForConstruct']
--
Edit bug report at http://bugs.php.net/?id=30536&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=30536&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=30536&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=30536&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=30536&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=30536&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=30536&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=30536&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=30536&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=30536&r=support
Expected behavior: http://bugs.php.net/fix.php?id=30536&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=30536&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=30536&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=30536&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=30536&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=30536&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=30536&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=30536&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=30536&r=float
MySQL Configuration Error: http://bugs.php.net/fix.php?id=30536&r=mysqlcfg