From: coolfactor at mac dot com Operating system: OS X 10.5.8 PHP version: 5.3.0 PHP Bug Type: Class/Object related Bug description: unserialize() doesn't handle changes in property visibility
Description: ------------ Unserializing an object after changing some of its class properties' from public to protected results in properties present in both states. (As a workaround, migration code can be written using get_object_vars() to update the a protected property from the corresponding public version within a __wakeup() call.) Reproduce code: --------------- (It's difficult to write reproduce code for this, so I hope the following step-by-steps are OK) 1. Object "John" of class "Person" stored in serialized form has property "age" with public visibility. 2. Change visibility of property "age" in class definition to "protected". 3. Unserialize "John". The property "age" will be present in both public and protected states. 4. Attempting to access the "age" property directly correctly returns the value stored in the protected version. 5. Using get_object_vars() returns the value stored in the public version. Expected result: ---------------- Changes in property visibility should migrate the values gracefully upon unserialization. Properties by any given name should only exist once, but the current behavior conflicts with that. Actual result: -------------- Both versions of a property (public and protected) exist in unserialized object. -- Edit bug report at http://bugs.php.net/?id=49649&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=49649&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=49649&r=trysnapshot53 Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=49649&r=trysnapshot60 Fixed in SVN: http://bugs.php.net/fix.php?id=49649&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=49649&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=49649&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=49649&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=49649&r=needscript Try newer version: http://bugs.php.net/fix.php?id=49649&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=49649&r=support Expected behavior: http://bugs.php.net/fix.php?id=49649&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=49649&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=49649&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=49649&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=49649&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=49649&r=dst IIS Stability: http://bugs.php.net/fix.php?id=49649&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=49649&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=49649&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=49649&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=49649&r=mysqlcfg