Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:40179 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 97272 invoked from network); 31 Aug 2008 01:15:50 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 31 Aug 2008 01:15:50 -0000 Authentication-Results: pb1.pair.com header.from=dafneves@gmail.com; sender-id=pass; domainkeys=bad Authentication-Results: pb1.pair.com smtp.mail=dafneves@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 64.233.166.181 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: dafneves@gmail.com X-Host-Fingerprint: 64.233.166.181 py-out-1112.google.com Received: from [64.233.166.181] ([64.233.166.181:18133] helo=py-out-1112.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id D4/89-27196-5C0F9B84 for ; Sat, 30 Aug 2008 21:15:50 -0400 Received: by py-out-1112.google.com with SMTP id a25so789799pyi.16 for ; Sat, 30 Aug 2008 18:15:47 -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:to :subject:cc:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=aRwVw+rypGC7/hFofUV1fAQcpgeZ4w542N1PNYqwv84=; b=JxaJq/37IK6spRh7V78kaA3C0Qd4pWWt6bbguw2fGbCsOX0DtpMYK3xql/oQ/pl2CO h+G36oYbJ04TfhOTnmWYGzpfkfDICO1yCfSEcS8WI77bkDtvyc4JlcGx/21oQ9fHVKU5 mPj9S/p95DEQL0WZDXCD/DNMUYxot8BBHxLGc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=UJNW7L2/7rluVZVBRMaNs/DnwSW6on5Dtc2sNhj68//w/8ZiQlD5DuCw2wO8WPExrB yK4ez081u93gJfGo1uHNHz25aNkHX6Bwy8mz0ic8/DCf7iEXkbG+N+CXpdC1dvjK6AA1 vrBOBxam8PhCRdPeruO6YmIoXkpqmtD7ld8gw= Received: by 10.65.188.2 with SMTP id q2mr9102870qbp.11.1220145347434; Sat, 30 Aug 2008 18:15:47 -0700 (PDT) Received: by 10.65.242.4 with HTTP; Sat, 30 Aug 2008 18:15:47 -0700 (PDT) Message-ID: <87ae45950808301815n56c57e17ra3c204280d5a5c8@mail.gmail.com> Date: Sun, 31 Aug 2008 02:15:47 +0100 To: "Mike Lively" Cc: "Antony Dovgal" , internals@lists.php.net In-Reply-To: <8d7b8c130808301735h76252afme4baabe322355f60@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <87ae45950808301302o24f164daj4377a360f3ed1a2c@mail.gmail.com> <48B9B3F8.2060409@suse.de> <48B9B55A.6050707@lerdorf.com> <87ae45950808301550n392cee6ft245c7be188b30e7b@mail.gmail.com> <48B9D1EC.2080101@daylessday.org> <8d7b8c130808301735h76252afme4baabe322355f60@mail.gmail.com> Subject: Re: [PHP-DEV] __call() magic method From: dafneves@gmail.com ("Diogo Neves") Hi, __get() makes more sense to me, and maybe was where | got the ideia because | never used __call() before but i add used __get() :( Maybe the php folks change its behavior in future... It's worthy of a bug report ( I ask because i'm not very involved in php community ) Thanks, On Sun, Aug 31, 2008 at 1:35 AM, Mike Lively wrote: > Antony, > I don't at all disagree about the inappropriateness of this not triggering > an error but I did want to point out that this behavior is not consistent > with how __get() works. It seems like they should all behave similarly when > dealing with overriding methods or properties of different access levels. > > +++ Attempting to access a private property > mikel@mikel-desktop:~$ php -r 'class A { private $a; } $a = new A; $a->a;' > Fatal error: Cannot access private property A::$a in Command line code on > line 1 > > +++ Attempting to access a private property when __get() is defined > mikel@mikel-desktop:~$ php -r 'class A { private $a; public function > __get($var) { echo $var, "\n"; } } $a = new A; $a->a;' > a > > +++ Attempting to access a private method > mikel@mikel-desktop:~$ php -r 'class A { private function a() {} } $a = new > A; $a->a();' > Fatal error: Call to private A::a() from invalid context in Command line > code on line 1 > > ++ Attempting to access a private method when __call is defined > mikel@mikel-desktop:~$ php -r 'class A { private function a() {} public > function __call($method, $parms) { echo $method, "\n"; } } $a = new A; > $a->a();' > > Fatal error: Call to private A::a() from invalid context in Command line > code on line 1 > > On Sat, Aug 30, 2008 at 4:04 PM, Antony Dovgal wrote: >> >> On 31.08.2008 02:50, Diogo Neves wrote: >>> >>> Exactly... >>> >>> Is that normal workings or more like a bugie one? >> >> Definitely not a bug. >> >> I believe the reason is that if you enable __call() in this case, you'd >> have different behavior depending on the calling scope, i.e. complete mess. >> Also there would be no way to know you're calling a method you're not >> supposed to call (unless you trigger an error yourself). >> >> -- >> Wbr, Antony Dovgal >> >> -- >> PHP Internals - PHP Runtime Development Mailing List >> To unsubscribe, visit: http://www.php.net/unsub.php >> > > -- Thanks for your attention, Diogo Neves Web Developer @ SAPO.pt by PrimeIT.pt