Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:74120 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 7217 invoked from network); 11 May 2014 04:38:04 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 11 May 2014 04:38:04 -0000 Authentication-Results: pb1.pair.com smtp.mail=swhitemanlistens-software@cypressintegrated.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=swhitemanlistens-software@cypressintegrated.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain cypressintegrated.com designates 173.1.104.101 as permitted sender) X-PHP-List-Original-Sender: swhitemanlistens-software@cypressintegrated.com X-Host-Fingerprint: 173.1.104.101 rproxy2-b-iv.figureone.com Received: from [173.1.104.101] ([173.1.104.101:50687] helo=rproxy2-b-iv.figureone.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 1B/20-05833-AAEFE635 for ; Sun, 11 May 2014 00:38:03 -0400 Received: from 124.1.168.192.in-addr.arpa ([108.12.130.219]) by rproxy2-b-iv.figureone.com (Brand New Heavy v1.0) with ASMTP id XJW06954 for ; Sat, 10 May 2014 21:37:54 -0700 Date: Sun, 11 May 2014 00:38:22 -0400 Reply-To: Sanford Whiteman X-Priority: 3 (Normal) Message-ID: <1774092137.20140511003822@cypressintegrated.com> To: Levi Morrison In-Reply-To: References: <536D3C30.9010801@sugarcrm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Anonymous functions inside static methods. From: swhitemanlistens-software@cypressintegrated.com (Sanford Whiteman) > Yes... but we fix bugs all the time that are technically BC breaks. Do you > really think we shouldn't fix this? My thought was: if there's a place for get_called_class() in a closure in production code, it's been tested to expect the current behavior. Every time I've used g_c_c() it was to set up some delicate runtime logic. But if g_c_c() always returns the compile-time class of the parent method, that's a value you already know from inspecting the code. So the call is likely unnecessary. It could come from cut-and-paste... things happen. But probably not doing anything that can't be done without it. So I'm coming around to agreeing on a necessary BC break. > Another option is to implicitly promote closures inside of static contexts > to be also be static; this is basically what HHVM does. PHP does this! That's why you get 'Cannot bind an instance to a static closure' if you closure->bindTo() inside a static method, even if the closure itself is not keyworded `static`. The difference between HHVM and PHP is the default class scope of the closure. PHP makes the decision that the owning class scope of the closure is the compile-time class of the parent method. Why this was done I couldn't say. -- S.