ID: 36694
Updated by: [EMAIL PROTECTED]
Reported By: iain at iaindooley dot com
-Status: Open
+Status: Assigned
Bug Type: Class/Object related
Operating System: FreeBSD 6.0
PHP Version: 5.1.2
-Assigned To:
+Assigned To: helly
Previous Comments:
------------------------------------------------------------------------
[2006-03-11 03:44:09] iain at iaindooley dot com
that echo statement should be:
echo('called unserialize<br />');
in function unserialize(), still the same result though :-)
------------------------------------------------------------------------
[2006-03-11 03:42:02] iain at iaindooley dot com
Description:
------------
when an object is stored in the session, serialize is called on that
object when the script finishes executing if that object implements
Serializable, but unserialize is not called when the session is
reloaded
Reproduce code:
---------------
<?
class SomeClass implements Serializable
{
private $member;
public $another;
function SomeClass()
{
$this->member = 'member value';
$this->another = 'another value';
}
public function serialize()
{
echo('called serialize<br />');
}
public function unserialize($serialized)
{
echo('called serialize<br />');
}
}
class AnotherClass extends SomeClass
{
function AnotherClass()
{
$this->SomeClass();
}
}
$obj = new AnotherClass();
session_name('god');
session_start();
$_SESSION['var'] = $obj;
?>
Expected result:
----------------
called serialize
called unserialize
Actual result:
--------------
called serialize
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=36694&edit=1