|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2017-04-13 20:41 UTC] tom at altrooz dot com
Description: ------------ This issue was introduced in 5.6.30, and does not exist in 5.6.29. Unfortunately the data structures that showed this effect are too complicated to include, and my effort to create a smaller reproducable case was not successful. But here's the story: *) A class implemented Serializable *) It has a member of type SplFixedArray, which has a __wakeup() function *) The container held other class instances that did not override the default serialization behavior *) Some of those classes included instances of ImmutableDateTime, which also has a __wakeup() function When unserializing the top-level class, the __wakeup() function on the SplFixedArray and ImmutableDateTime instances did not get called. PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 07:00:01 2025 UTC |
That is valuable information and one would hope that future security patches don't change application behavior. I'm sure you can now create a simple test case - The code that failed here is in the CakePHP framework, and has this innocuous construct (edited for brevity): class XXX implements Serializable { private $contents; // expected to be an instance of SplFixedArray private $contents_size; public function serialize() { return serialize($this->contents); } public function unserialize($data) { $this->contents = unserialize($data); $this->contents_size = count($this->contents); } } It is expected that when the SplFixedArray instance is rehydrated, it is now complete and can be referenced. In 5.6.29 (and of course every version before) this works correctly, but in 5.6.30 the count(SplFixedArray) returns 0 because __wakeup() has not been called on it. *All* object-oriented languages guarantee that class instances are completely instantiated before they are able to be accessed by the developer.