Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:9946 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 66065 invoked by uid 1010); 18 May 2004 20:00:06 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 66022 invoked by uid 1007); 18 May 2004 20:00:06 -0000 Message-ID: <20040518200006.66020.qmail@pb1.pair.com> To: internals@lists.php.net References: <20040518040006.36155.qmail@pb1.pair.com> <20040518143120.34847.qmail@pb1.pair.com> Date: Tue, 18 May 2004 13:00:05 -0700 Lines: 80 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 X-Posted-By: 169.229.135.175 Subject: [PATCH] Re: Bug#27798 protected/private access and get_object_vars() From: pollita@php.net ("Sara Golemon") > > The next question that brings up then is in relation to bug#27798: > > > > I would think that get_object_vars() should expose private/protected props > > when called from within the class itself (as appropriate based on > > inheretance of course). Is this assumption true? > > yeah, I think that's how it should work. > Then how does this patch look: http://frankenbox.alphaweb.net/test/27798.diff With the following script: class A { public $a = 'A'; protected $b = 'B'; private $c = 'C'; function look_from_a() { echo "From A: "; var_dump( get_object_vars($this) ); } } class B extends A { function look_from_b() { echo "From B: "; var_dump( get_object_vars($this) ); } } $b = new B(); $b->look_from_a(); $b->look_from_b(); echo "From outside the objects: "; var_dump(get_object_vars($b)); It displays: From A: array(3) { ["a"]=> string(1) "A" ["b"]=> string(1) "B" ["c"]=> string(1) "C" } From B: array(2) { ["a"]=> string(1) "A" ["b"]=> string(1) "B" } From outside the objects: array(1) { ["a"]=> string(1) "A" } Everyone happy with that behavior? -Sara