Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:82553 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 51050 invoked from network); 12 Feb 2015 20:20:08 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 12 Feb 2015 20:20:08 -0000 Authentication-Results: pb1.pair.com smtp.mail=nikita.ppv@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=nikita.ppv@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.212.174 as permitted sender) X-PHP-List-Original-Sender: nikita.ppv@gmail.com X-Host-Fingerprint: 209.85.212.174 mail-wi0-f174.google.com Received: from [209.85.212.174] ([209.85.212.174:36503] helo=mail-wi0-f174.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 94/E0-45232-8FA0DD45 for ; Thu, 12 Feb 2015 15:20:08 -0500 Received: by mail-wi0-f174.google.com with SMTP id em10so7287285wid.1 for ; Thu, 12 Feb 2015 12:20:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=6kZW0WMZCzpsxAwbQIIz2zZ8W8x9axIvQPtySl5pgqE=; b=x+E4nbN6fyeCOrQaz//URgqvBqEgXjfT859QABsQDgstXY/Vnr4j19Mmllf4J6KFZ6 R6afrTAp+aGnTbSOwkdOx6ddrcFkIM9QweXEuv/VHBBqXLEIGBUnWEE6kGnCfR8ccwU1 Bpf3tLuJ9+xwR1uJ9LlD4DJSRSxBe4gjwqtltPuFAUNTr0Sy+FjO6DSYAlPUuyUoYZ3w M8i5nqG2yTyf4bJES+D31xtwnLQmS+Yq9mM0clh6tZ0cs8p+KjnuBT3qyblyKU4nMllt xSeNK1bj3qj0j7Ky9SP2DraHk7XW28gtyATLfTIqJeDb/jyY4tl0UKEvSgeaCt0BiPE1 j7/g== MIME-Version: 1.0 X-Received: by 10.180.189.52 with SMTP id gf20mr9625860wic.27.1423772404895; Thu, 12 Feb 2015 12:20:04 -0800 (PST) Received: by 10.27.10.168 with HTTP; Thu, 12 Feb 2015 12:20:04 -0800 (PST) In-Reply-To: <54DCD8B7.40700@gmail.com> References: <54DCD8B7.40700@gmail.com> Date: Thu, 12 Feb 2015 21:20:04 +0100 Message-ID: To: Rowan Collins Cc: PHP internals Content-Type: multipart/alternative; boundary=001a11c347506f5448050ee9d855 Subject: Re: [PHP-DEV] Remove $this from incompatible context From: nikita.ppv@gmail.com (Nikita Popov) --001a11c347506f5448050ee9d855 Content-Type: text/plain; charset=UTF-8 On Thu, Feb 12, 2015 at 5:45 PM, Rowan Collins wrote: > Nikita Popov wrote on 12/02/2015 14:24: > >> Hi internals, >> >> As part of [1] and [2] we have decided to remove support for doing static >> calls to instance methods, if this would result in an incompatible $this >> variable to be used. When applying [3] this change we found that the >> change >> as originally intended may be too strict. >> > > [snip] > > The compromise I'd like to implement instead is to only throw a fatal >> error >> if $this is actually used in the called method and otherwise throw a >> deprecation warning. Calls from instance methods, static methods and >> functions will all be handled the same. >> > > [snip] > > I'm definitely in favour of this over completely forbidding such calls. > > The only thing I'd question is the use of E_DEPRECATED when the static > call doesn't use $this. Is there actually any intent to change the > behaviour in a future version? What is the advantage to doing so? It > strikes me as rather like the case of "var" for properties, which had the > deprecation notice removed. > > I think it would make more sense to raise an E_STRICT, since the main > purpose seems to be to discourage users making such calls. > The reason is that previously it was using E_DEPRECATED in some places and E_STRICT in others. I'd like to have a consistent error level in all cases, so using E_DEPRECATED everywhere (I am not willing to downgrade existing deprecations to strict warnings). And yes, I'm pretty sure there is intent to remove this completely in the future - this is just another leftover from PHP 4. The approach outlined here only avoids dropping support in PHP 7 already (which the original patch did for all practical purposes). Nikita --001a11c347506f5448050ee9d855--