Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:82578 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 31970 invoked from network); 13 Feb 2015 04:45:24 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 13 Feb 2015 04:45:24 -0000 Authentication-Results: pb1.pair.com smtp.mail=dev@mabe.berlin; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=dev@mabe.berlin; sender-id=unknown Received-SPF: error (pb1.pair.com: domain mabe.berlin from 80.237.132.167 cause and error) X-PHP-List-Original-Sender: dev@mabe.berlin X-Host-Fingerprint: 80.237.132.167 wp160.webpack.hosteurope.de Received: from [80.237.132.167] ([80.237.132.167:40108] helo=wp160.webpack.hosteurope.de) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 66/51-23345-3618DD45 for ; Thu, 12 Feb 2015 23:45:23 -0500 Received: from dslb-088-074-071-013.088.074.pools.vodafone-ip.de ([88.74.71.13] helo=[192.168.178.30]); authenticated by wp160.webpack.hosteurope.de running ExIM with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) id 1YM87z-0003vm-Sb; Fri, 13 Feb 2015 05:45:19 +0100 Message-ID: <54DD815F.70504@mabe.berlin> Date: Fri, 13 Feb 2015 05:45:19 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: internals@lists.php.net References: <54DD1BB1.1090501@gmail.com> In-Reply-To: <54DD1BB1.1090501@gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-bounce-key: webpack.hosteurope.de;dev@mabe.berlin;1423802723;ace8f564; Subject: Re: [PHP-DEV] Remove $this from incompatible context From: dev@mabe.berlin (Marc Bennewitz) Hi Stas, Am 12.02.2015 um 22:31 schrieb Stanislav Malyshev: > Hi! > >> class A { >> // This is an *instance* method, but it doesn't actually use $this. >> // This kind of usage is very common in PHP 4 era code, where >> // "static" annotations weren't used >> function test() { >> echo "foo"; >> } >> } >> >> class B { >> function test2() { >> // This call would be forbidden because it assumes $this of class >> B, when >> // calling an instance method of class A. However A::test() does >> not actually >> // use $this! >> A::test(); >> } >> } > IMHO, this should work. Maybe issue E_STRICT, but even then I'd think > it's not really necessary, I can't see any purpose E_STRICT serves in > this case - since $this is not used, no potential bug is averted, as the > code works exactly as it was supposed to be working. Such code will break, not in the first place but later on! You propose that every instance method not using the variable $this internally will be magically a static method and can never ever be changed to use $this without an bc break. > > Marc