Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:95394 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 42780 invoked from network); 22 Aug 2016 22:26:02 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 22 Aug 2016 22:26:02 -0000 Authentication-Results: pb1.pair.com header.from=morrison.levi@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=morrison.levi@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.192.194 as permitted sender) X-PHP-List-Original-Sender: morrison.levi@gmail.com X-Host-Fingerprint: 209.85.192.194 mail-pf0-f194.google.com Received: from [209.85.192.194] ([209.85.192.194:33951] helo=mail-pf0-f194.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 90/87-33251-9FB7BB75 for ; Mon, 22 Aug 2016 18:26:01 -0400 Received: by mail-pf0-f194.google.com with SMTP id g202so7044633pfb.1 for ; Mon, 22 Aug 2016 15:26:01 -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:content-transfer-encoding; bh=AdTIpx1rbqyi+flAbvfmepl0IGBsF+wJrdmzl0vWINI=; b=YqNBtQoZy2cAZ+bkZ0EFTNuRWRr1Yrw3TEJ2bxQp5wGf+WjDGlLqfmG/cTnO2ySQxr 27LHhb4PqJMGYYH/oC5xElsY9XZm7BfijS74NkUz2WnFzEsKa8XwU507lDahXvPR1rJs FAFz0w2UcHtjsfsHqux08E7djla4jq6fzxwm/cxuHB8FnbaaxylYxOpfmM/A2YuPdnW9 cGQZWD6NSxscUqYMHwfHVLuWeGlZetYbTL/mOS/doc8QOtwijnc/fFb5JoHjl+GvvXFW Vhtp7EbWSP5TEuSuN4Z+v1RL8COwZfSvJgoMrkr2tv4qBJNXpI8JqkZ6iq1zKLx7CN2p Bpag== 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:content-transfer-encoding; bh=AdTIpx1rbqyi+flAbvfmepl0IGBsF+wJrdmzl0vWINI=; b=hUVi+/wJ5gcL/fIvMOmMvAzbtKhuzPkcjXMQFOt0ppNOvWANEoqCKYEJaCaUJrepni ARZv7dKTwO+G/G5hQRaJr7xRT24vR/BqXO5qZPr5dnZ4wOCwmodwOjqpE0BsIJ7qWojQ Vsw3yq3zXTbuot30EG+XEMBxhhfv5D6pTfjujgSkfLGm/GPoAF0ruCsOoeo8AhIOYpnl o9jNKyPhxDqCO55H9jp9d2XX7xDayNUDmpM2dtVbuOeBVJDxGaxmYHwjP/CCXqaHf1Pi wHegGUQmwo960QZ+KFGNtnRxai55206LBmrXVjPFsuAZG4aeFpU3wDx3qjbwrS2Eaenl ROMw== X-Gm-Message-State: AEkoouv9GmlVbAq7Z50hQ8t85xsoaEU1VI0VHwG55EI2RNz9nRD3bF2p43dlzPWVIWL1gus3F2vT61lCaGMYYA== X-Received: by 10.98.33.72 with SMTP id h69mr46831783pfh.28.1471904758683; Mon, 22 Aug 2016 15:25:58 -0700 (PDT) MIME-Version: 1.0 Sender: morrison.levi@gmail.com Received: by 10.66.24.42 with HTTP; Mon, 22 Aug 2016 15:25:57 -0700 (PDT) In-Reply-To: <031a2bf1-1996-1144-2b85-e10a40be9514@gmail.com> References: <031a2bf1-1996-1144-2b85-e10a40be9514@gmail.com> Date: Mon, 22 Aug 2016 16:25:57 -0600 X-Google-Sender-Auth: qXp9dlT8RsSEH8rMsCSWkji61EA Message-ID: To: Rowan Collins Cc: "internals@lists.php.net" Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] BC break: ReflectionMethod::invoke() expects parameter1 to be object, string given From: levim@php.net (Levi Morrison) On Mon, Aug 22, 2016 at 3:40 PM, Rowan Collins wr= ote: > > On 22/08/2016 20:57, Levi Morrison wrote: >> >> I think the ideal but difficult path forward is to find where it was int= roduced and pray the commit log or something else will indicate the behavio= r. > > > OK, I'll bite. > > Christoph already linked to this comment in the source [https://github.co= m/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/7cb0480d04933e3d27b75edf29822815a6108= 894/ext/reflection/php_reflection.c#L2163 > > Before that, it was in zend_reflection_api.c, and blames back to the rath= er general "more of Timm's implementation" committed by George Schlossnagle= in July 2003: https://github.com/php/php-src/commit/84f5e4870e13f76a6223a0= a937809092ae70d543#diff-cf9733a6fe0eeed1f5a44b59667967baR984 > > The inconsistency then comes in when invokeArgs is added by Marcus Boerge= r over a year later: https://github.com/php/php-src/commit/41b87ab486c26f9b= 2d1bc315988b8e8271b6e06b > > The new methods made use of the (presumably new?) zend_parse_parameters s= ystem, and specified the first argument as a mandatory object, which was fi= xed a few days later to have an optional object, and a separate check when = it is required: https://github.com/php/php-src/commit/63b288c4646d405d0edfb= 7657505b2acf5643514 > > Notably, the same comment completely ignoring the first parameter was pre= sent in that first implementation of invokeArgs. > > 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 prett= y clear that the only thought put into the first argument with static metho= ds is "ignore it". > > 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 gi= ve? > - 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 b= e an oversight. > > Regards, > > -- > Rowan Collins > [IMSoP] > > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php 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.