Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:95389 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 28437 invoked from network); 22 Aug 2016 18:34:20 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 22 Aug 2016 18:34:20 -0000 Authentication-Results: pb1.pair.com header.from=rowan.collins@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=rowan.collins@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.49 as permitted sender) X-PHP-List-Original-Sender: rowan.collins@gmail.com X-Host-Fingerprint: 74.125.82.49 mail-wm0-f49.google.com Received: from [74.125.82.49] ([74.125.82.49:37566] helo=mail-wm0-f49.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id DB/55-33251-BA54BB75 for ; Mon, 22 Aug 2016 14:34:20 -0400 Received: by mail-wm0-f49.google.com with SMTP id i5so158928402wmg.0 for ; Mon, 22 Aug 2016 11:34:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding; bh=1mNJFRm92RsegfxGw95tCgiQWZ4IgyonLNlz+iIf11s=; b=GXbftde+ECDnG5JQGkjvYgyCFlv8prqNRnE7XqEY5vBDBFeNCvGccDFQUnltFAvo15 9mCBP+KEHahQE4qTGwOAc+aHanjO/P0H+fXk4IklMFM9uf/fmobP10WkOzvZW6ybzwf1 ABnDN79ctR3DrzRt9Rf+p/h60xUNcFVEF5ETIxshGL0Fez14tMMyQ6ruQt6WKcvLTod+ Hu1T2DMVw4QZ9YZVN5onNUGcgndPYaKgpkzySAl1P8MN1co2VtFFLn6GJWaHm8TFj2LD l1jQ0qMYtpGIUaZ1TZgSN6UTeXLeC6Yu7DOqdHzVJ5zZnj/LYND9SW4qc9msmhi199hy ATAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=1mNJFRm92RsegfxGw95tCgiQWZ4IgyonLNlz+iIf11s=; b=jxLqkIP73SjVGgLEi1cDvg7b5QZwIWNZHwwqHpmm9uk0iqQp19JoK+Oh+LLa9AbeGp JD2TSeYV2M0GhgiOC5RAna78Z4Fd09qY8jmD0ZquZ+u/S6Jw2sJnrsICX5ODHpZqo0UN ybuwBH054yI7pP1e1YKVSIVXTj9fbMEM9SHCO52Cw1HwIj4RSZ6M1Fu0yMbIlHu0cQey qc814BlekZIGNLbVFE2g4g84PoJLKXZCk4EMM0VYHd67xtGDSomgUA3JkyfoEpH8X4NE oGb578axXD8THZH9jRRh8WOul66eCt2+0k3D6htA5fFbMDmKCTH5icqaYVwo5TjB/4cQ 1qLw== X-Gm-Message-State: AEkoousc98aQ/6dL8ZLrgNKDVUstP5jm7Tnnpvv8N+4yp/WKDNMlAheCDgcUzYfGUcMAaw== X-Received: by 10.28.63.8 with SMTP id m8mr17856436wma.88.1471890855839; Mon, 22 Aug 2016 11:34:15 -0700 (PDT) Received: from [192.168.1.5] ([95.148.161.240]) by smtp.googlemail.com with ESMTPSA id ex14sm25599155wjc.30.2016.08.22.11.34.14 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 22 Aug 2016 11:34:15 -0700 (PDT) To: PHP Internals References: Message-ID: Date: Mon, 22 Aug 2016 19:34:14 +0100 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; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] BC break: ReflectionMethod::invoke() expects parameter1 to be object, string given From: rowan.collins@gmail.com (Rowan Collins) On 22/08/2016 17:30, Christoph M. Becker wrote: >> I think @Alexander is right. >> >We should allow passing a string, and perform some Late Static Binding >> >through it. >> >That would solve the BC Break problem as well as extend the feature in >> >a more PHP-friendly way. > Are you sure that would solve the BC break? As it were, one could pass > an arbitrary string. I can easily imagine that some refactoring > introduced a new class in a hierarchy, but nobody noticed that an > ::invoke() call would have to be adjusted accordingly. Suddenly > changing the meaning of the first parameter may well introduce a > behavioral change. Yeah, that was basically my concern as well: giving the string parameter a meaning is no more compatible than rejecting it. It is, at least, more *useful*, but it does make the same code do subtly different things in the new version. One question which would need addressing is what should happen if you reflect a static method call, and pass in an object as the invocation context: - As currently, even with the patch that's in beta, ignore the object completely? (This seems broken to me.) - Reject it outright, saying that it must be a string or null? (Simple, but not very user-friendly.) - Verify that it's of the right type (as with a non-static invocation), then take its class as the context of the call? (Seems best, but possibly complex?) Altogether, I think this may need more thought than a rushed fix during a beta cycle. How about reverting the behaviour for 7.1 and changing carefully in 7.2? Regards, -- Rowan Collins [IMSoP]