#43395 [NEW]: unserialize reinitialize unsetted object's properties
| From: | ramdac at sweetorange dot it | Date: | Sat, 24 Nov 2007 11:58:25 +0000 |
| Subject: | #43395 [NEW]: unserialize reinitialize unsetted object's properties | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-120001@lists.php.net to get a copy of this message | ||
From: ramdac at sweetorange dot it
Operating system: Linux 2.6.20-16-generic
PHP version: 5.2.5
PHP Bug Type: Scripting Engine problem
Bug description: unserialize reinitialize unsetted object's properties
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 bug report at http://bugs.php.net/?id=43395&edit=1
--
Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=43395&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=43395&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=43395&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=43395&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=43395&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=43395&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=43395&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=43395&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=43395&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=43395&r=support
Expected behavior: http://bugs.php.net/fix.php?id=43395&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=43395&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=43395&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=43395&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=43395&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=43395&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=43395&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=43395&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=43395&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=43395&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=43395&r=mysqlcfg