note 27076 added to language.oop.magic-functions

From: Date: Thu, 21 Nov 2002 22:23:36 +0000
Subject: note 27076 added to language.oop.magic-functions
Groups: php.notes 
Request: Send a blank email to php-notes+get-39837@lists.php.net to get a copy of this message
Hi all I have some issues with the '__sleep()' function in 'extended' classes. Firstly, here is a simplified example of my class setup:- class A { var $one; var $two; Function SomeFunctions ...() Function __sleep() { return array('one', 'two'); } } class B extends A { var $three Function SomeMoreFunctions ...() Function __sleep() { return array( 'three', 'one', 'two'); } } My issue is that variable $three never gets recreated in subsequent pages. Variables $one and $two get re-created perfectly. So what's going on here .... is there some specific call order I should be following OR does '__sleep' and '__wakeup' not work across class hierachies and only works for the base class. Please help someone ! Thanks -- http://www.php.net/manual/en/language.oop.magic-functions.php http://master.php.net/manage/user-notes.php?action=edit+27076 http://master.php.net/manage/user-notes.php?action=delete+27076 http://master.php.net/manage/user-notes.php?action=reject+27076

« previous php.notes (#39837) next »