|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2012-02-27 09:59 UTC] mike@php.net
-Status: Open
+Status: Not a bug
[2012-02-27 09:59 UTC] mike@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 12:00:01 2025 UTC |
Description: ------------ unserialize() in a class implementing Serializable is not called when the serialized object is contained within a container element (e.g. array). Compare with __wakeup() which IS called in the same environment. In the test script below, if the class is modified to not extend Serializable, the output is: Sleep Wakeup Test script: --------------- class Foo implements Serializable { public function __sleep() { print "Sleep\n"; return array(); } public function __wakeup() { print "Wakeup\n"; } public function serialize() { print "Serialize\n"; } public function unserialize($data) { print "Unserialize\n"; } } $a = array( new Foo() ); $b = serialize($a); unserialize($b); Expected result: ---------------- Serialize Unserialize Actual result: -------------- Serialize