Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:92955 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 96011 invoked from network); 29 Apr 2016 17:43:32 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 29 Apr 2016 17:43:32 -0000 Authentication-Results: pb1.pair.com smtp.mail=bishop.bettini@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=bishop.bettini@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.218.49 as permitted sender) X-PHP-List-Original-Sender: bishop.bettini@gmail.com X-Host-Fingerprint: 209.85.218.49 mail-oi0-f49.google.com Received: from [209.85.218.49] ([209.85.218.49:36415] helo=mail-oi0-f49.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 01/B2-26386-24D93275 for ; Fri, 29 Apr 2016 13:43:30 -0400 Received: by mail-oi0-f49.google.com with SMTP id x201so126709508oif.3 for ; Fri, 29 Apr 2016 10:43:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:reply-to:sender:in-reply-to:references:from:date :message-id:subject:to:cc; bh=LhQpqaAwLodVKoPbSsx3tqT01EREzLShw/VYZJg4LbA=; b=BoFSkcmhldui6LIngpa11M1cW/ZbRrqVgucKPCnid3gTZh3NAQKFmE7L992QbuZblD pB1foLlUD8/D3ZaGDkeCYElZIDYw490qTIeoyBMUBkgaSQY8bMSaLSa070nGzIYqy5pf HvaTriN6rgAA3HLJ77Iht+lvTyytgs3e0ap1OSKWIkb/cD9jY6SRb0c8NRJXAF19UMm8 RogphQ0sSPDIhvHMyHyT7QoFLTBgyX2Ht66qrv0GX85BUqp8xpMWy550G6i+1s4VwbEZ W8i39wnxv7de+uvMVWJmPJAgNNf5uArrMhvgFfPKr3xMYQ75bd4JUGxpXYODtzclSRhb OLTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:reply-to:sender:in-reply-to :references:from:date:message-id:subject:to:cc; bh=LhQpqaAwLodVKoPbSsx3tqT01EREzLShw/VYZJg4LbA=; b=mE7BrvkH/0MvtUQsV4igJAHf4RnE6KQd6Oe+djv7KEry//c5Osx2N38J38R8DyJ5xY 7ctdrBfRtUQwQnte8tbPQjen9Lj2gy4JkO/bhVlk6Z0q4pNfvHTIzUrjjHLDaiZRO3Rl tddmJLUK8Zo49rg6cjJ5x5fCvoWXXCdeiDOfZ55xLczg8q5Ita0RwT8AlnHAL8ruPahV /I98S18Dw0snlccTgHz8fRbrhwysMuq8g7cbCHCEX5m/Y5BTFOuufwNtStIkx1ogsFKK AS6ZD9BmCr6v5T1sGfmIPPJgYLdoi8anS92v7n4jUTtegPFWXSRcBXnuRA9wf0IjMdrO tMvg== X-Gm-Message-State: AOPr4FWiC0rxC0SghTRs26U0+jdLjCvWzvXGI9eBcvr/xxTPqF1eenaf0Bh+1eF2Him0ZgwmMqU6c69wH2D23g== X-Received: by 10.202.204.21 with SMTP id c21mr8749864oig.188.1461951807873; Fri, 29 Apr 2016 10:43:27 -0700 (PDT) MIME-Version: 1.0 Reply-To: bishop@php.net Sender: bishop.bettini@gmail.com Received: by 10.157.36.137 with HTTP; Fri, 29 Apr 2016 10:42:58 -0700 (PDT) In-Reply-To: References: Date: Fri, 29 Apr 2016 13:42:58 -0400 X-Google-Sender-Auth: jjMYOk8BueNeJnRONYSv6PeKMaw Message-ID: To: Nikita Popov Cc: PHP internals Content-Type: multipart/alternative; boundary=001a113524002fe9180531a32e93 Subject: Re: [PHP-DEV] [RFC] Forbid $this being null in instance methods From: bishop@php.net (Bishop Bettini) --001a113524002fe9180531a32e93 Content-Type: text/plain; charset=UTF-8 On Fri, Apr 29, 2016 at 1:12 PM, Nikita Popov wrote: > Hi internals! > > I'd like to submit a small RFC for your consideration, which ensures > something that really ought to be a given already: If you use $this in an > instance method, you should actually get a $this (and not NULL). > > https://wiki.php.net/rfc/forbid_null_this_in_methods > > As this is targeting PHP 7.1, the RFC is careful to retain compatibility > with certain legacy PHP 4 code patterns. > What is the performance cost of inspecting the method for $this, and is that inspection impervious to tricks that shield $this? Example: A::method(); class A { public function method() { $foo = function () { $this->something(); } } } Does that throw an \Error? Would it throw an \Error if $foo() were called? --001a113524002fe9180531a32e93--