Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:52002 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 35196 invoked from network); 24 Apr 2011 20:09:17 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 24 Apr 2011 20:09:17 -0000 Authentication-Results: pb1.pair.com smtp.mail=keisial@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=keisial@gmail.com; sender-id=pass; domainkeys=bad Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.170 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: keisial@gmail.com X-Host-Fingerprint: 74.125.82.170 mail-wy0-f170.google.com Received: from [74.125.82.170] ([74.125.82.170:40526] helo=mail-wy0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 74/D0-22678-C6384BD4 for ; Sun, 24 Apr 2011 16:09:17 -0400 Received: by wyb34 with SMTP id 34so1405974wyb.29 for ; Sun, 24 Apr 2011 13:09:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:message-id:date:from:user-agent:mime-version:to :cc:subject:references:in-reply-to:content-type :content-transfer-encoding; bh=sH8ei2wPf6tEOcdla8iVOh4eHvBmLBETexnL97IGnjo=; b=iRRBFIAubl74aQyFoNRso4IuFCvMtTFebRmCZfqxVXaBcgH7FVaoZcpK8Sf8Mx9hQu qw56jZxrOlU4LGKM3VBBGD4rvMPkT1XhNkrPBs8MKujY4VbK+zGDxULshjZCcpS2vn+H y1jkuxPomeQC2hecwo/H8vSRcgopLMwli6odU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; b=Q1fRZxn9MrdFb3aGzvkOJkVMe2/Y9SNpR13nxPTwa8c//TlkOzfycfsGanX7YzvpFr z/5bL/JGqrjm5vjq/AnC2DLyU8HtjaENxuAd/onQJ3O8NHWnRciUy93HykEkSwex4qS2 krc/VkR7SnYQu1FGh6B4mjKMxKfiEvtnhjxQk= Received: by 10.216.121.200 with SMTP id r50mr2770290weh.7.1303675753817; Sun, 24 Apr 2011 13:09:13 -0700 (PDT) Received: from [192.168.1.26] (111.Red-83-42-241.dynamicIP.rima-tde.net [83.42.241.111]) by mx.google.com with ESMTPS id w25sm2913120wbd.22.2011.04.24.13.09.11 (version=SSLv3 cipher=OTHER); Sun, 24 Apr 2011 13:09:12 -0700 (PDT) Message-ID: <4DB4847B.3080004@gmail.com> Date: Sun, 24 Apr 2011 22:13:47 +0200 User-Agent: Thunderbird MIME-Version: 1.0 To: reeze CC: PHP internals list References: <5870D50E38AE4374833F83A59ABFB59E@gmail.com> In-Reply-To: <5870D50E38AE4374833F83A59ABFB59E@gmail.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Call non-static method staticly raise E_STRICT, but why call a static method instancely won't From: keisial@gmail.com ("=?UTF-8?B?w4FuZ2VsIEdvbnrDoWxleg==?=") reeze wrote: > Hi, > I am not sure it's the right place to discuss this. someday I found I call a static method _instancely_. > the method is just a helper method when reviewing my code. I know I do the wrong thing, but PHP doesn't > complain about it. then I do some tests like below: A few corrections to your test case so it actually works. > error_reporting(E_ALL ^ E_STRICT); I think you want E_ALL | E_STRICT > class A { > public function static staticFunc() { This is a parse error. static should be placed before function. > echo "static"; > } > public function instanceFunc() { > echo "instace"; > } > } > > A::instanceFunct(); // Strict Standards: Non-static method A::instanceFunc() ... And this should be A::instanceFunc(); > $a = new A(); > $a->staticFunc(); // Just static no E_STRICT error raised > > I know it's the wrong way to do like these, maybe there are some historical reasons to allow these. > I just wonder why previous method call raise E_STRICT but later not. > > Yes, something could be done doesn't means we should, but we could stop things like happened. I think it may be related to inheritance.