Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:95415 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 12620 invoked from network); 23 Aug 2016 14:58:42 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 23 Aug 2016 14:58:42 -0000 Authentication-Results: pb1.pair.com smtp.mail=morrison.levi@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=morrison.levi@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.220.45 as permitted sender) X-PHP-List-Original-Sender: morrison.levi@gmail.com X-Host-Fingerprint: 209.85.220.45 mail-pa0-f45.google.com Received: from [209.85.220.45] ([209.85.220.45:35481] helo=mail-pa0-f45.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id B0/70-10212-1A46CB75 for ; Tue, 23 Aug 2016 10:58:41 -0400 Received: by mail-pa0-f45.google.com with SMTP id hb8so30442795pac.2 for ; Tue, 23 Aug 2016 07:58:41 -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=AEpEtEpijmEi7imYYCLpD7kGMs3uL9FZgxV7dt21/Zo=; b=CcOJgnVDF0sKJ0U1lx5lf9q/ZXjYmiTeRbesYS4985NZ3biTRsOhH19jnIqIZz2z+f iDbmPF7kDQA35jQncV8p3iXNS+krLtZUvC44jCL9zyPJI4UJenjMzM9A+TUZ/xSI54s3 3B4pKQY+WbNzlHzNBEUKoT7W3n7PoZpRpWaz96NAHHzvHr76E7qIqki7oMeOjXrgtAhk DCJR/zz+++Z9W7Cvng0m4rnaGGZDbANStqbqr6cxiymp2Pw56iN17pPDGzhH3m4Oz2RA Q8uGUV916u8dcun1AHsjJ2aD8Ij0zEMnRrTMBZsCJJPj9sjAySMV4Q6cIyBF842XtXnn ViYw== 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=AEpEtEpijmEi7imYYCLpD7kGMs3uL9FZgxV7dt21/Zo=; b=dxGOrAKwKkRYFFSxp9x7RSrhV6VSDFkbg2eE32WRcdZCvKv/lmcr/5X/K9wkBEqOR0 VZMtRn4EfO0DfqTheEtygiRJKleksFFP5CPzkOxzR9d12+uQGwvz4XGvFgYwEcZzw9OO UMAZlAmUG0EXupSZo1Lv1Yo2d2hOOZf3YjdR59m+SaSuoG6sF0LDNTV7ZSR2OHJ8pw8g jIXJYqXvv6d5O6UCdcpCcUrQTxWlU6wyBOQcLMSGd4SUrawoS8JbeGE0Yg6RgO9W7/4l /4gwgqWZEYsFJ4xrbQlfPJJ29HzmPBerUhI2y233E4lFBXt2AQMSEA0b3JH7jI9+sZRt sX3Q== X-Gm-Message-State: AEkoous2gmdihyZ+ztygVxXZ9KU4VizATl1pYn1iq/JbBAdXLhB/MCCtXN5P8mRisldAw3xHytG4WTmYDj9COg== X-Received: by 10.66.220.194 with SMTP id py2mr53289142pac.77.1471964318207; Tue, 23 Aug 2016 07:58:38 -0700 (PDT) MIME-Version: 1.0 Sender: morrison.levi@gmail.com Received: by 10.66.24.42 with HTTP; Tue, 23 Aug 2016 07:58:37 -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 08:58:37 -0600 X-Google-Sender-Auth: C77FrOG6_W1wZ32ADR3eVt5VwvI Message-ID: To: Julien Pauli 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: levim@php.net (Levi Morrison) 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?