Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:49196 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 47882 invoked from network); 3 Aug 2010 11:23:52 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 3 Aug 2010 11:23:52 -0000 Authentication-Results: pb1.pair.com header.from=tyra3l@gmail.com; sender-id=pass; domainkeys=bad Authentication-Results: pb1.pair.com smtp.mail=tyra3l@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.214.170 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: tyra3l@gmail.com X-Host-Fingerprint: 209.85.214.170 mail-iw0-f170.google.com Received: from [209.85.214.170] ([209.85.214.170:33515] helo=mail-iw0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id D2/15-16995-64CF75C4 for ; Tue, 03 Aug 2010 07:23:51 -0400 Received: by iwn33 with SMTP id 33so1117419iwn.29 for ; Tue, 03 Aug 2010 04:23:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:sender:received :in-reply-to:references:date:x-google-sender-auth:message-id:subject :from:to:cc:content-type:content-transfer-encoding; bh=NoNqpThE0+fVRl/KVfjju/dSbsbuq4JCVwrbnJVAFaY=; b=S+mAq1SCnaSBdovi0nRPNPV4JaAmEn2XLjjD/CB6BPzYPSk+gjIQp815HlgpzEmcsT jHwGzQMNeCWXroXbJV6SjgAKhPubnqJ+pDNWTGCjG+G6CjQ7DcaqXtONr0hfudbUEEbB ma+MRCdPvymmffBABbYinesEI38HhsZ93qUrE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=rhqDdZPMB7ivKm30Fw277xNG/Qn8FRz8THpBKOsS5MgHy8wXh1MoK0BI4km1pb8J88 FUJOqKiL3t/drMWeaOS38+cddqQ7jD549JuxA6qXoggCwOgALDkNZ9pyXLK3NZZU0Ioy tUxMDAbhpTW9VvEmXAvBXke22Onjl4JUWZ36s= MIME-Version: 1.0 Received: by 10.231.14.200 with SMTP id h8mr7182741iba.188.1280834627912; Tue, 03 Aug 2010 04:23:47 -0700 (PDT) Sender: tyra3l@gmail.com Received: by 10.231.161.79 with HTTP; Tue, 3 Aug 2010 04:23:47 -0700 (PDT) In-Reply-To: References: <9EC2A53FAB8D4BEAA7973FD5765BE428@sinahp> Date: Tue, 3 Aug 2010 13:23:47 +0200 X-Google-Sender-Auth: 0by8L_Pf7U0SbzT-lFlPrLo6-34 Message-ID: To: Victor Bolshov Cc: Shijiang , PHP internals Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] Confusing performance of the magic method __call From: info@tyrael.hu (Ferenc Kovacs) 2010/8/3 Victor Bolshov : > Shijiang, did you notice the > > -- > Warning: The magic method __call() must have public visibility and cannot= be > static in Command line code on line 1 > -- > > ??? > > 2010/8/3 Shijiang > >> Hi, >> >> In the following sample code, I expected that the magic method __call on= ly >> works within the class Test. >> But it seems that the access control keyword private lost its efficacy w= hen >> working together with the magic method __call. >> >> > class Test{ >> =C2=A0 =C2=A0private function __call($name,$params){ >> =C2=A0 =C2=A0 =C2=A0 =C2=A0echo $name,"\n"; >> =C2=A0 =C2=A0 =C2=A0 =C2=A0echo $params[0]; >> =C2=A0 =C2=A0} >> >> =C2=A0 =C2=A0public function bar(){ >> =C2=A0 =C2=A0 =C2=A0 =C2=A0$this->kakaka('afaafaf'); >> =C2=A0 =C2=A0} >> } >> $foo=3Dnew Test; >> $foo->bar('sfsfss'); >> $foo->nothing('works'); // this also works without any errors. >> ?> >> >> IMHO, since the function __call is a method of a class, it should obey t= he >> visibility rules. >> >> Cheers. >> > > > > -- > =D0=A1 =D1=83=D0=B2=D0=B0=D0=B6=D0=B5=D0=BD=D0=B8=D0=B5=D0=BC, > =D0=92=D0=B8=D0=BA=D1=82=D0=BE=D1=80 > It was added/changed with 5.3 so it is not necessarly obvious. Tyrael