Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:95405 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 92136 invoked from network); 23 Aug 2016 13:02:42 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 23 Aug 2016 13:02:42 -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 74.125.82.46 as permitted sender) X-PHP-List-Original-Sender: julienpauli@gmail.com X-Host-Fingerprint: 74.125.82.46 mail-wm0-f46.google.com Received: from [74.125.82.46] ([74.125.82.46:37635] helo=mail-wm0-f46.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id F3/35-49014-1794CB75 for ; Tue, 23 Aug 2016 09:02:41 -0400 Received: by mail-wm0-f46.google.com with SMTP id i5so194499793wmg.0 for ; Tue, 23 Aug 2016 06:02: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=GfFPbLQhjxsQJeIcTisfDVMmuHTxK+PIaLrt6ne+ByY=; b=lwiLgxZvRvDdtoiJ8IFNnwnyWANpI3cG6UYi9Bb6DZsVCV+3cYtV7QzxftFQNYUKQJ Oo11FP2XxNynsMTwof5YuXhTI7NqdgtqlKXos0DRpEfGVO+/1Xa5+3GJdscNT3uHwYaA NTphuHZy9WiivuKdwM+xZQobkkm9HE15uCMKanu5wECSPYWx8VFhM4BRSZaikXVPvMro +Apmmnyh3B+AeYLhJHPrasQRm3l0yD+mdOLmYuPrKCC372fFYp+0SjbwE4tn4nSNqUKg Xunimmh/NBAUEjDEH0Br99CiamHRcjUIFkz9J6hJLraPhdVAXhpiACYwZeM9W3JcoWIj iF9g== 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=GfFPbLQhjxsQJeIcTisfDVMmuHTxK+PIaLrt6ne+ByY=; b=PqlX8ZbNei4IjxI3G8ODbFPc65VqapbH9+VaSzajkQ2cjLtUN84mOGwuk3souEaBdg vRHniFMvzuaf9HkfchEnBHuFjtEFeU71HfpkMtbs5axFM+lr8wgCLEa63cCe6DvYUanJ /1z7DBFzjnC7DLlcoZcIaGOU1UUuII0QKX2Yhuj8pDp12UXNXUyoGHx/xb1mXweKAUAb UaUuBb64WM7Z2cg/+mwMutwa18FR7eWfo4asU4TSEDZAuD5lilF/MprTcURU+VK8rVlK k9VX4z8vS7ZmfBfJs3ARtCCZBeInt/CBoGGjBLFCw5SyplkVBu3mlFmzMDSC6RSI7t1E BKrw== X-Gm-Message-State: AEkoouvSBHPpHSJv1dNVb5PRSZr/25nWipRDsJ+ixmSHypwF0ysOeXO0wBPd6cI6y1zCAntJu6k4e58M46pzDA== X-Received: by 10.28.48.149 with SMTP id w143mr19190672wmw.54.1471957358596; Tue, 23 Aug 2016 06:02:38 -0700 (PDT) MIME-Version: 1.0 Sender: julienpauli@gmail.com Received: by 10.194.45.4 with HTTP; Tue, 23 Aug 2016 06:01:57 -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 15:01:57 +0200 X-Google-Sender-Auth: sfsQTr516l0RG7qz0oWmBq2Uxvg Message-ID: To: Alexander Lisachenko Cc: "Christoph M. Becker" , Levi Morrison , 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 2:56 PM, Alexander Lisachenko wrote: > > 2016-08-23 14:51 GMT+03:00 Christoph M. Becker : >> >> I suggest to deprecate all other types than NULL as first arg for static >> methods, because passing an int, for instance, makes even less sense as >> Rowan has already pointed out elsewhere in this thread. > > > > Alternative suggestion (vote for Julien's patch): use first argument as a > string with LSB scope name, see my message from late 2013 year: > http://markmail.org/message/ogeh33jedumgo5lx. > > I agree, that all other types don't make any sense. So my suggestion is > following: for dynamic methods it should accept object or null. Null can > mean that we want to unbind the method from the object and maybe call it > like a closure? (just compare this with Closure::bindTo behaviour). For > static methods this could be object (why not - it will be ignored), string > (in this case it will be a scope name if we want to call parent method with > preserving Late Static Binding) or just null (null will be equal to the > string with object class name) > > Thoughts? > It makes no sense to change the scope of the method. A method is not a closure. A method is bound to a class , a closure is by default unbound. A method cannot be unbound. A method cannot change from one class to another. This : class A { public static function foo() { } } class B extends A { public static function foo() { } } $a = new reflectionMethod('A', 'foo'); $a->invoke('B'); would lead to the exact equivalent as this with my patch : $b = new reflectionMethod('B', 'foo'); $b->invoke(); So I don't see why we should change and patch the code to support such a strange use case ... If you want to call B's foo , create a ReflectionMethod from B, not from A. Julien