Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:44108 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 27759 invoked from network); 1 Jun 2009 01:47:31 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 1 Jun 2009 01:47:31 -0000 Authentication-Results: pb1.pair.com header.from=nrixham@gmail.com; sender-id=pass; domainkeys=bad Authentication-Results: pb1.pair.com smtp.mail=nrixham@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.219.214 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: nrixham@gmail.com X-Host-Fingerprint: 209.85.219.214 mail-ew0-f214.google.com Received: from [209.85.219.214] ([209.85.219.214:49744] helo=mail-ew0-f214.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id C8/A6-20810-233332A4 for ; Sun, 31 May 2009 21:47:30 -0400 Received: by ewy10 with SMTP id 10so8106757ewy.23 for ; Sun, 31 May 2009 18:47:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:reply-to :user-agent:mime-version:to:cc:subject:references:in-reply-to :content-type:content-transfer-encoding; bh=um5J8XDut9WAjhYUAcwozYQSQ9Jb2AiUzmN4zPo0NMA=; b=tbu+4NDKbAKtEIi3FtuRLaKb06aG1m1yRSlw5DoZ+Oa4LFnwNO+IhEz09L1catw3tl z5dWUN59s4uOP5PPtr/s9q5KOu/UhRPYms31xmKxhJAKubpq12LO8fMFil3kMKlSZ7B/ sBq6naM/8XaBdPA09k2hOPgnR1RU5PPGUxGvo= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:reply-to:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; b=irAtFG/92KaheDhBY2lF2GhEEWx6GTDCgyGZ/P5DYlQhJwLnvDrYEPkNqh0rzu4gav N4khSOUESvrlzlJqT6BYlDsWuP9S+hOSLP+Ay/GrlR+2IqjegfniOQpjxJKds79Iafk6 7XQUB6rsL2dkaq1HMfFsJLmXkxbYa91GfOFBI= Received: by 10.210.88.3 with SMTP id l3mr5707243ebb.88.1243820847607; Sun, 31 May 2009 18:47:27 -0700 (PDT) Received: from ?192.168.2.4? (82-41-135-70.cable.ubr02.grth.blueyonder.co.uk [82.41.135.70]) by mx.google.com with ESMTPS id 21sm8115590ewy.42.2009.05.31.18.47.26 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sun, 31 May 2009 18:47:26 -0700 (PDT) Message-ID: <4A23330D.4000205@gmail.com> Date: Mon, 01 Jun 2009 02:46:53 +0100 Reply-To: nrixham@gmail.com User-Agent: Thunderbird 2.0.0.21 (Windows/20090302) MIME-Version: 1.0 To: Matt Wilson CC: internals@lists.php.net References: <32074276-E941-45C8-B1A1-9A6EB34F4D7E@gmail.com> In-Reply-To: <32074276-E941-45C8-B1A1-9A6EB34F4D7E@gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] need inverted __sleep? From: nrixham@gmail.com (Nathan Rixham) Matt Wilson wrote: > get_class_vars + array_diff cheers but nope; as the manual says "Returns an associative array of default public properties of the class" need private and inherited private > On May 31, 2009, at 8:04 PM, Nathan Rixham wrote: > >> Hi All, >> >> hoping somebody can help me here.. >> >> I need to implement an inverted __sleep method, by which I mean to >> specify what variables should not be included. >> >> use case: >> > class base >> { >> private $notToBeSerialized; >> >> public function __sleep() >> { >> // TODO code return instance properties excluding $notToBeSerialized >> } >> >> } >> >> class foo extends base >> { >> private $bar; >> } >> >> class poo extends foo >> { >> private $baz; >> } >> >> $p = new poo; >> echo serialize($p); >> >> ---- >> >> I've tried using get_object_vars($this), and ReflectionObject($this) >> both of which don't include all the properties of the instance. >> >> the only way I can see to get all the properties of the instance is to >> serialize($this) then parse the string, but that's just wrong and what >> would sleep return on the first call to serialize. >> >> any help greatly appreciated. >> >> regards, >> >> nathan >> >> -- >> PHP Internals - PHP Runtime Development Mailing List >> To unsubscribe, visit: http://www.php.net/unsub.php >> > >