Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:95398 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 69639 invoked from network); 23 Aug 2016 08:30:20 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 23 Aug 2016 08:30:20 -0000 Authentication-Results: pb1.pair.com smtp.mail=cmbecker69@gmx.de; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=cmbecker69@gmx.de; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmx.de designates 212.227.15.15 as permitted sender) X-PHP-List-Original-Sender: cmbecker69@gmx.de X-Host-Fingerprint: 212.227.15.15 mout.gmx.net Received: from [212.227.15.15] ([212.227.15.15:53609] helo=mout.gmx.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 13/91-49014-9990CB75 for ; Tue, 23 Aug 2016 04:30:19 -0400 Received: from [192.168.2.103] ([79.243.115.246]) by mail.gmx.com (mrgmx001) with ESMTPSA (Nemesis) id 0Lkwc9-1b2ENc2Gt3-00an12; Tue, 23 Aug 2016 10:30:13 +0200 To: Levi Morrison , Rowan Collins References: <031a2bf1-1996-1144-2b85-e10a40be9514@gmail.com> Cc: "internals@lists.php.net" Message-ID: <7b81c830-1d05-a4ac-4713-1bb67cbec12c@gmx.de> Date: Tue, 23 Aug 2016 10:30:39 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K0:IzjrBnhQrrKoKZVomlqrCHM/uHll2xs0xZRdOjQfip2eBLOQRm9 rBIFWIkZudvA7sx0VbJnLZ4QiGMFNghm0pmLdZ3xd7j51iMdsb+SqoREwTciKH+eZmXkT/n t8CRmsvAa9/5KVjFc/GQMTXZDDaMyQ95i/Kt6bryuhzfKjiygo2XLwjUs5vZ7RcaKULxv5Q csuydJt3tM3VfrAvGCOnQ== X-UI-Out-Filterresults: notjunk:1;V01:K0:H7R7LmwwqI4=:+yQaEboOhCMAFB3L57e7uu vFhqXDe3ZDbDL4inmvgOyRNqUAhnPVQww8/kRRw4mj6KbzAHhrWodRuSdwX9KZpoU0ZXj+zIY 4E3Hn/3FrP4+CdPOegWVQ7AJCG51nGwg5dkmm1astfeLSXpmOaJteYuH6LkwguoVQ9O/6HaRF 7aYlY9La+6RcLR3YJRkqRKRwE1vUBjKzhhZJgzBloPfZ575aGzMHoVLzmhYI7mf0/7vmp/RG7 GFJEC5EmrLnZndwmmCRtBaPKIvSiaPwRRO5+60dBQGflMhU/X2XgJo21L0aWqfhBWET5HQuxI RLTZzKg2iPVbARvMlI191E2wfYSnW0zhgxDbpK99iZgKliHR97s1lCiAi2akuDlGDke+Xm7vC ajuNBWwIhqSOBXWcT99tpkW4fuZj0pWKt0olfpNCjf5Phw96/RsfzxMUYZV3ZX3CviASYWDCL RyQaC0ZRTmeNtJN0FdSRyoyojFYkQ9l7H/y4ul2/P/x3pd67XZ/2CpyXYwLwfx6cGpg10PrBI 7VNfQXTWKj/4yFeZBsNGZ2EKToxlds6tu7+jpULLy3Cxl6e1bTWfmD7Vswk/EOu9Ib8ZtQSac LlpklZZNI39nBE09cSZ5Kwc6RrRmkFGzm/85cYH2UlojziNTfg4UVKLegpgVJi0pKHecq1CL6 vb9isk/vVYPi53OExsG2R0FqOkQ7kXFd+YlkykpGclgFuRd8dYndL4vmjxZj/idejBaK1DTOs Bfe3kGnEbiy41C8kUHd+tvCyw4Lxd4aDBz/rcUvuYPG8MxnuqXDKe9vNxvlh2spTKMdXsKi6I jEmXaEY Subject: Re: [PHP-DEV] BC break: ReflectionMethod::invoke() expects parameter1to be object, string given From: cmbecker69@gmx.de ("Christoph M. Becker") On 23.08.2016 at 00:25, Levi Morrison wrote: > On Mon, Aug 22, 2016 at 3:40 PM, Rowan Collins wrote: >> >> Christoph already linked to this comment in the source [https://github.com/php/php-src/blob/PHP-7.0.10/ext/reflection/php_reflection.c#L3197-L3202]: >> >>> /* In case this is a static method, we should'nt pass an object_ptr >>> * (which is used as calling context aka $this). We can thus ignore the >>> * first parameter. >>> * >>> * Else, we verify that the given object is an instance of the class.. >>> */ >> >> A simple blame takes that comment back effectively unchanged to Nov 2005, when reflection was first moved to "ext/reflection": >> https://github.com/php/php-src/blob/7cb0480d04933e3d27b75edf29822815a6108894/ext/reflection/php_reflection.c#L2163 >> >> Before that, it was in zend_reflection_api.c, and blames back to the rather general "more of Timm's implementation" committed by George Schlossnagle in July 2003: https://github.com/php/php-src/commit/84f5e4870e13f76a6223a0a937809092ae70d543#diff-cf9733a6fe0eeed1f5a44b59667967baR984 >> >> The inconsistency then comes in when invokeArgs is added by Marcus Boerger over a year later: https://github.com/php/php-src/commit/41b87ab486c26f9b2d1bc315988b8e8271b6e06b >> >> The new methods made use of the (presumably new?) zend_parse_parameters system, and specified the first argument as a mandatory object, which was fixed a few days later to have an optional object, and a separate check when it is required: https://github.com/php/php-src/commit/63b288c4646d405d0edfb7657505b2acf5643514 >> >> Notably, the same comment completely ignoring the first parameter was present in that first implementation of invokeArgs. Thanks for investigating on the history, Rowan! >> So, it's pretty clear to me that there was no intention for the two to be different, just different contributors at different times. It's also pretty clear that the only thought put into the first argument with static methods is "ignore it". ACK >> None of which really answers what the behaviour should be, in my opinion. We still have to decide 3 things: >> >> - Is there a compelling reason to change the current behaviour? >> - What error or behaviour should a string or other non-object argument give? >> - What error or behaviour should an object argument give? >> >> In my opinion, the best "fix", if something needs to change, would be to reject anything other than null; that anything else works appears to just be an oversight. > > Anyone oppose to emitting E_DEPRECATED for a parameter other than an > object or null? This opens up the possibility to use it for something > no earlier than 8.0. That appears to be the most reasonable compromise presented yet. Thanks Levi! I suggest to wait for Julian, though, who wrote: "I'll prepare a patch exposing my ideas soon." -- Christoph M. Becker