Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:49194 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 44977 invoked from network); 3 Aug 2010 11:14:46 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 3 Aug 2010 11:14:46 -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:56350] helo=mail-iw0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 41/74-16995-02AF75C4 for ; Tue, 03 Aug 2010 07:14:40 -0400 Received: by iwn33 with SMTP id 33so1109787iwn.29 for ; Tue, 03 Aug 2010 04:14:37 -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=xWFiMItoXT2im5YWSG6EbME9fy8dQys+Kq4WBkAmC0U=; b=uGFY5CmrvK2n9oLN8sEY4F2gLwhsRvZpyh7ayhqtW1JAajWIC7fpU0uTR2sHUgO2E9 8q7z8CL1E5WPppiaDyVMbwt4XaGs984z1oDBqkYWEXU0PmNEMmVDxNbRoNx3ft0cRKp0 50IMYNpILxmWI5xTWWO/Bb7IVOxeyX7tGegJ0= 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=W6cydzHLmm1UB2HXfPfviIaqrq2mJbkVQFJmbz8/Z5l75qtipk6jgEskGPcrTFEEfb mTtxanvUPSAtoz8AHRfI3z+DVaIcUbpdMhA3s8ubEj/DVYfsaWBytQ1/KGimQoECc/gE AX3SK0yHUWof9R/HcHKYiFFiRYI6aVoQkxhTc= MIME-Version: 1.0 Received: by 10.231.191.6 with SMTP id dk6mr8723286ibb.51.1280834077740; Tue, 03 Aug 2010 04:14:37 -0700 (PDT) Sender: tyra3l@gmail.com Received: by 10.231.161.79 with HTTP; Tue, 3 Aug 2010 04:14:37 -0700 (PDT) In-Reply-To: <9EC2A53FAB8D4BEAA7973FD5765BE428@sinahp> References: <9EC2A53FAB8D4BEAA7973FD5765BE428@sinahp> Date: Tue, 3 Aug 2010 13:14:37 +0200 X-Google-Sender-Auth: bDv5N5zi80movXb7EzqQXy6obc0 Message-ID: To: Shijiang Cc: 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 Shijiang : > Hi, > > In the following sample code, I expected that the magic method __call onl= y works within the class Test. > But it seems that the access control keyword private lost its efficacy wh= en 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 th= e visibility rules. > > Cheers. > http://www.php.net/manual/en/migration53.incompatible.php The magic methods __get, __set, __isset, __unset, and __call must always be public and can no longer be static. Method signatures are now enforced. Tyrael