Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:44107 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 26323 invoked from network); 1 Jun 2009 01:41:37 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 1 Jun 2009 01:41:37 -0000 Authentication-Results: pb1.pair.com smtp.mail=shadda@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=shadda@gmail.com; sender-id=pass; domainkeys=bad Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.216.187 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: shadda@gmail.com X-Host-Fingerprint: 209.85.216.187 mail-px0-f187.google.com Received: from [209.85.216.187] ([209.85.216.187:56876] helo=mail-px0-f187.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id EA/56-20810-0D1332A4 for ; Sun, 31 May 2009 21:41:37 -0400 Received: by pxi17 with SMTP id 17so558313pxi.29 for ; Sun, 31 May 2009 18:41:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:cc:message-id:from:to :in-reply-to:content-type:content-transfer-encoding:mime-version :subject:date:references:x-mailer; bh=eFmk6mAKycKc0Ef0EbRF4OZBOEDpRVQSxb6Ez1tnszE=; b=AEoDoTIgYNAZiVfbiKuE78Ooy8kbIwMIs/pJwhcRJTJuQmiX4KwluV2+TUlmzCMr/8 ski7JATQuhxeHtybwdbUBdzfe3UmpBZYTf/1bfuog/hren3tV6tEetMF2FJQFdMWhp/K VCsnh3NoohbNWzK7lWb9NMKA7j4dbNIhP2jKE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=cc:message-id:from:to:in-reply-to:content-type :content-transfer-encoding:mime-version:subject:date:references :x-mailer; b=py+JjOZZVyndOR/OgjOo7OjQmZcKrOWploPVLYINLN5bdRPy12lFLtQ1YZyxW3zjCR l6qt5GO098vEXcrtFg8nK/ftbRNvLTX2UQHhTjRc4yMFmTuPHMbT6O6T3ROrmQ+OIJPv 7dQUqYiLp88xfZGO0nld/EOs2vTPPBktZQiBk= Received: by 10.141.116.17 with SMTP id t17mr5631393rvm.268.1243820493769; Sun, 31 May 2009 18:41:33 -0700 (PDT) Received: from ?192.168.1.159? ([75.87.134.66]) by mx.google.com with ESMTPS id f21sm13332008rvb.45.2009.05.31.18.41.31 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sun, 31 May 2009 18:41:32 -0700 (PDT) Cc: internals@lists.php.net Message-ID: <32074276-E941-45C8-B1A1-9A6EB34F4D7E@gmail.com> To: Nathan Rixham In-Reply-To: Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v935.3) Date: Sun, 31 May 2009 20:44:27 -0500 References: X-Mailer: Apple Mail (2.935.3) Subject: Re: [PHP-DEV] need inverted __sleep? From: shadda@gmail.com (Matt Wilson) get_class_vars + array_diff 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 >