ID: 36696
Updated by: iliaa@php.net
Reported By: iain at iaindooley dot com
-Status: Assigned
+Status: Bogus
Bug Type: Session related
Operating System: *
PHP Version: 5.1.2
Assigned To: sas
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
When putting objects into session or serializing them manually put the
instantiation result into a variable 1st and then use it.
Ex. $a = new Object();
$_SESSION['obj'] = $a;
Doing so avoids temp var, which gets destroyed right away hence leading
to the wrong order of operations.
Previous Comments:
------------------------------------------------------------------------
[2006-03-20 23:25:16] tony2001@php.net
Assigned to the maintainer.
------------------------------------------------------------------------
[2006-03-13 19:54:55] helly@php.net
exactly
------------------------------------------------------------------------
[2006-03-13 11:07:12] iain at iaindooley dot com
Just for clarity, i presume you mean using:
session_write_close();
before the scripts conclude.
------------------------------------------------------------------------
[2006-03-13 10:53:59] helly@php.net
The solution is easy: close the session before ending your scripts.
Otherwise this is a session shutdown issue.
Assigning to primary session maintainer.
------------------------------------------------------------------------
[2006-03-11 04:30:02] iain at iaindooley dot com
Description:
------------
if an object that impelements Serializable is stored in the session,
and implements __destruct, then __destruct is called before serialize()
when the script finishes execution.
Reproduce code:
---------------
<?
class SomeClass implements Serializable
{
function SomeClass()
{
}
public function unserialize($dat)
{
echo('called unseriazlize');
}
public function serialize()
{
echo('called serialize<br />');
}
function __destruct()
{
echo('called __destruct<br />');
}
}
session_name('god');
session_start();
$_SESSION['var'] = new SomeClass();
?>
Expected result:
----------------
called serialize
called __destruct
Actual result:
--------------
called __destruct
called serialize
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=36696&edit=1