Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:95418 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 16227 invoked from network); 23 Aug 2016 15:06:09 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 23 Aug 2016 15:06:09 -0000 Authentication-Results: pb1.pair.com header.from=julienpauli@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=julienpauli@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.220.182 as permitted sender) X-PHP-List-Original-Sender: julienpauli@gmail.com X-Host-Fingerprint: 209.85.220.182 mail-qk0-f182.google.com Received: from [209.85.220.182] ([209.85.220.182:33584] helo=mail-qk0-f182.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 68/31-10212-1666CB75 for ; Tue, 23 Aug 2016 11:06:09 -0400 Received: by mail-qk0-f182.google.com with SMTP id z190so109220888qkc.0 for ; Tue, 23 Aug 2016 08:06:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=0eobTtsc85+7ixfbf9gH9JwiSgH8YgA4WzsSn93HBXM=; b=CCNhE+zeis/Xpt5CNw05pWBdQM+rVItWav3QKqkCqsUlbQc1UB2y8vOv7NDdcQSFVL 98hNVh4sBV7Fi0Qz2zDaia5cI4Yyk4YplJ4RTlfaRSsgVnnQlW+Ka1FDE2jA7qnv3jyt 3E0WvNN8xKPbzCJ4iSKR7ztXbT7V9cogfs3vrCWIbEWvngkY5C1BgnchRntA5jKau0FC l3Ngq+6NMZTtnyfsby2xc06QqiBJcLb7ESDojwRYnbHv0RZfYbj5TmBQd8VjuyH7pkSe Nf/S/APKrBqIerng2GH21kVOBXAPR/i3GROWvxO7gn4VwFq404AiS4GrAkClAn4gUZXX GW/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=0eobTtsc85+7ixfbf9gH9JwiSgH8YgA4WzsSn93HBXM=; b=CUos5FV4X+N3bsEZsw9QrgbyyjD64OkKaoQsn3xOMeIjRZci46NTcBh6WGpIVz9iIA 9MWZqwm4FhUQyx60ztwcohDe46xnjTPaNx6nsfOSA+Hs0kq0PRdkxVXrsfthDxMTMWmL BpiyMA2iTLEVxbIsymN1Fe1VHCiUwAFLsRUm/p6xSN8N2hws6C8YXNxk+5cWkyhiWiFe P28FAnTlYVMk91ZHGNa+hEoTUjnWu6etcpQGAsM0arcdRQdIO9VIIlhEdgcxtSaj0S8u OfW7bSA6dIQdeQFrkEB4jywxBVprARCyBszL4ffMfMAxiFoXqKB1DCKLIkYk4F54qNoO hb2w== X-Gm-Message-State: AEkoouvsAKxLuseUFX6lkvpmPgaWwgzI78cNRm+8fZiA+6TsOipJk2l/hOgTmgVVPq9K13FqDkmbA6CNVEAnmQ== X-Received: by 10.55.5.5 with SMTP id 5mr29793363qkf.275.1471964766650; Tue, 23 Aug 2016 08:06:06 -0700 (PDT) MIME-Version: 1.0 Sender: julienpauli@gmail.com Received: by 10.140.93.72 with HTTP; Tue, 23 Aug 2016 08:05:26 -0700 (PDT) In-Reply-To: References: <031a2bf1-1996-1144-2b85-e10a40be9514@gmail.com> <7b81c830-1d05-a4ac-4713-1bb67cbec12c@gmx.de> Date: Tue, 23 Aug 2016 17:05:26 +0200 X-Google-Sender-Auth: gfq9VFujfVoknxcnhwGaEJy5ZhM Message-ID: To: Levi Morrison Cc: Alexander Lisachenko , "Christoph M. Becker" , Rowan Collins , "internals@lists.php.net" Content-Type: text/plain; charset=UTF-8 Subject: Re: [PHP-DEV] BC break: ReflectionMethod::invoke() expects parameter1to be object, string given From: jpauli@php.net (Julien Pauli) On Tue, Aug 23, 2016 at 4:58 PM, Levi Morrison wrote: > On Tue, Aug 23, 2016 at 8:49 AM, Julien Pauli wrote: >> On Tue, Aug 23, 2016 at 4:13 PM, Levi Morrison wrote: >>> On Tue, Aug 23, 2016 at 7:56 AM, Alexander Lisachenko >>> wrote: >>>> >>>> 2016-08-23 16:40 GMT+03:00 Julien Pauli : >>>>> >>>>> My patch allows that, but I can't find a use case to it. >>>> >>>> >>>> >>>> My use case for that was decorating of static methods with additional >>>> behaviour, so it's possible to cache the result of static methods, etc. >>>> Unfortunately, reflection API doesn't provide me such an ability, so I >>>> decided to switch to the combination of special closure with >>>> forward_static_call_array() and binding it to the desired scope. >>>> >>>> >>>> 2016-08-23 16:40 GMT+03:00 Julien Pauli : >>>>> >>>>> Try it. >>>> >>>> >>>> Yes, sure, I will check. However as I say earlier, now I use closure >>>> extraction and scope binding as more natural way to invoke such methods. So >>>> missing scope argument for static methods and ReflectionMethod->invoke() is >>>> a nice thing to have, but not a critical one. >>> >>> Seems to me you should be calling getClosure() and using >>> Closure::bindTo before invoking it. ReflectionMethod::invoke is really >>> just a short-cut for a common case; I don't think it's reasonable to >>> have it mirror the Closure API just to save one method call to get a >>> Closure. >> >> This cannot work. >> There is a special use case forbidding that. >> "Cannot rebind scope of closure created by >> ReflectionFunctionAbstract::getClosure()" >> >> >> Julien > > I know this is a stability concern for internal classes but is there > anything really preventing this from user-land classes? I remember problems and bugs around this , but I don't remember the exact use-case why we forbid that. I guess Dmitry, Xinchen or Nikic could remember. Julien