Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:9956 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 40506 invoked by uid 1010); 20 May 2004 07:30:30 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 40461 invoked from network); 20 May 2004 07:30:29 -0000 Received: from unknown (HELO iko.gotobg.net) (80.168.8.116) by pb1.pair.com with SMTP; 20 May 2004 07:30:29 -0000 Received: from pd9519869.dip.t-dialin.net ([217.81.152.105] helo=hristov.com) by iko.gotobg.net with asmtp (Exim 4.24) id 1BQi0a-0006UH-6P; Thu, 20 May 2004 10:30:28 +0300 Message-ID: <40AC5E0A.2040600@hristov.com> Date: Thu, 20 May 2004 09:28:10 +0200 User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20031230 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Andi Gutmans CC: Christian Schneider , Sara Golemon , internals@lists.php.net References: <20040518040006.36155.qmail@pb1.pair.com> <20040518040006.36155.qmail@pb1.pair.com> <5.1.0.14.2.20040519152452.03197698@127.0.0.1> In-Reply-To: <5.1.0.14.2.20040519152452.03197698@127.0.0.1> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - iko.gotobg.net X-AntiAbuse: Original Domain - lists.php.net X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - hristov.com Subject: Re: [PHP-DEV] Re: protected/private access and var_dump/print_r From: php@hristov.com (Andrey Hristov) Andi Gutmans wrote: > At 11:42 AM 5/18/2004 +0200, Christian Schneider wrote: > >> Sara Golemon wrote: >> >>> var_dump($someobject); shows only public properties (as I'd expect), but >>> print_r($someobject) shows all properties (explicitly identifying >>> protected/private props). >> >> >> I agree with Derick and Andrey in that if anything should be changed >> it is var_dump. >> >> Reasoning: PPP is there to specify an interface, not to be used in a >> sandbox way. Both var_dump and print_r are for human inspection and I >> don't an advantage in hiding information there, quite the opposite. > > > I agree that showing all PPP makes more sense for these functions. They > are mainly debugging tools and for human inspection. Information hiding > is important on the language level itself. > > Andi > So, I have made a patch against HEAD : http://hristov.com/andrey/projects/php_stuff/patches/var_dump.diff.2.txt php -r 'class a{ protected $a=1; private $b=2;var $c=3;} $a=new a(); var_dump($a);' produces : object(a)#1 (3) { ["a:protected"]=> int(1) ["b:private"]=> int(2) ["c"]=> int(3) } I hope that everyone will be happy with this. var_dump() is still BC since it does not print ":public" on public properties. Andrey