ID:               43395
 Updated by:       [EMAIL PROTECTED]
 Reported By:      ramdac at sweetorange dot it
-Status:           Open
+Status:           Bogus
 Bug Type:         Scripting Engine problem
 Operating System: Linux 2.6.20-16-generic
 PHP Version:      5.2.5
 New Comment:

Of course it is set, unserialize() process uses the class definition
for re-creating the object. And as your class has the default value, of
course it will be re-created.

See also:
http://fi2.php.net/manual/en/language.oop.serialization.php


Previous Comments:
------------------------------------------------------------------------

[2007-11-24 11:58:25] ramdac at sweetorange dot it

Description:
------------
If I unset an object property, after serialize/unserialize the property
is re-initialized with default value defined in class declaration.

Reproduce code:
---------------
class test
{
    public $testUnset = 'default value';
}

$o = new test();
var_dump($o);

unset($o->testUnset);
var_dump($o);

$s = serialize($o);
$oo = unserialize($s);
var_dump($oo);

Expected result:
----------------
object(test)#1 (1) {
  ["testUnset"]=>
  string(13) "default value"
}
object(test)#1 (0) {
}
object(test)#2 (1) {
}

Actual result:
--------------
object(test)#1 (1) {
  ["testUnset"]=>
  string(13) "default value"
}
object(test)#1 (0) {
}
object(test)#2 (1) {
  ["testUnset"]=>
  string(13) "default value"
}


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=43395&edit=1

Reply via email to