|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2005-04-19 15:54 UTC] sniper@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Nov 21 14:00:02 2025 UTC |
Description: ------------ When defining a __sleep funtion in a class, it is not possible to successfully save and retrieve objects of this class using shm_put_var and shm_get_var. shm_get_var simple returns NULL. Reproduce code: --------------- <?php class Fruit { var $kind; var $foo = 'not'; function Fruit($kind) { $this->kind = $kind; } function __wakeup() { $this->foo = 'bar1'; } function __sleep() { $this->foo = 'bar2'; } // BREAKS shm_put_var/shm_get_var } $var = new Fruit('apple'); $key = 1; $shmId = shm_attach(24187); shm_put_var($shmId, $key, $var); $out = shm_get_var($shmId, $key); var_dump($out); ?> Expected result: ---------------- Expected output: object(Fruit)#2 (2) { ["kind"]=> string(5) "apple" ["foo"]=> string(4) "bar1" } Actual result: -------------- Actual output: NULL