Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:86802 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 89205 invoked from network); 23 Jun 2015 03:09:21 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 23 Jun 2015 03:09:21 -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.216.49 as permitted sender) X-PHP-List-Original-Sender: morrison.levi@gmail.com X-Host-Fingerprint: 209.85.216.49 mail-vn0-f49.google.com Received: from [209.85.216.49] ([209.85.216.49:41321] helo=mail-vn0-f49.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 1F/3B-07834-FDDC8855 for ; Mon, 22 Jun 2015 23:09:19 -0400 Received: by vnav203 with SMTP id v203so7542769vna.8 for ; Mon, 22 Jun 2015 20:09:16 -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:date:message-id:subject :from:to:cc:content-type; bh=CKiQbhyfFqgcsggo6bsQQMBoBsphCg8QpDGXz3bb6wY=; b=PY4yZzrymRYMXUJsZQYFdgAO5RHOe6SG6+TNuA9+UIjXI+CPhF7WYDzQYatA5bzV4H Q5bYTVsjyjXBRxy+/t7wfYcsfxLufgf1+9rQrl7Mu7rleBWxXoFiCpUbIGvYF/iBWgh4 Lv7iUn/qQ2+UkJWVlESV3eG/vqU93B7hjfpcEW/uXhuIl9vCANKbitMSn08LO79v1iSp dphbZfvcsSedd5acKFuWHajXvDdo18v9g0nXMAPH9vbsjhcvdiLaf+hqF/PtXHdsOFXq RdGC/LArbXOAcPDp55gkVJU2o3Ln23dfsX6IWWtgOTEqgYQscsb5QQeBtzUZNdWJQgdl Bsaw== MIME-Version: 1.0 X-Received: by 10.52.116.162 with SMTP id jx2mr28689428vdb.80.1435028956183; Mon, 22 Jun 2015 20:09:16 -0700 (PDT) Sender: morrison.levi@gmail.com Received: by 10.31.16.81 with HTTP; Mon, 22 Jun 2015 20:09:16 -0700 (PDT) In-Reply-To: <5588AEFC.1030409@lerdorf.com> References: <5586E5D1.4010901@lerdorf.com> <55870947.4060304@lerdorf.com> <5587334C.2080401@lerdorf.com> <55873676.6050706@gmail.com> <55876B29.90804@lerdorf.com> <55881A72.4090403@lerdorf.com> <5588477E.7050109@lerdorf.com> <5588A02C.4040602@gmail.com> <5588AEFC.1030409@lerdorf.com> Date: Mon, 22 Jun 2015 21:09:16 -0600 X-Google-Sender-Auth: xss0P9gSVjtgoo-HBzEIuLBz7uc Message-ID: To: Rasmus Lerdorf Cc: Stanislav Malyshev , Dmitry Stogov , Bob Weinand , Anatol Belski , Kalle Sommer Nielsen , Nikita Popov , PHP internals Content-Type: text/plain; charset=UTF-8 Subject: Re: [PHP-DEV] hasType() for internal function parameters? From: levim@php.net (Levi Morrison) On Mon, Jun 22, 2015 at 6:57 PM, Rasmus Lerdorf wrote: > On 06/22/2015 07:54 PM, Stanislav Malyshev wrote: >> Hi! >> >> So I tried to remove the checks for ZEND_ACC_HAS_TYPE_HINTS: >> https://github.com/php/php-src/pull/1354 >> >> Turns out there is a lot of tests that assume function with wrong >> arguments throws Error, but ZPP and type checks work differently - ZPP >> first checks argument number (and doesn't throw if number is wrong but >> instead creates warning), while type checks (that shouldn't really >> happen on internals but do) check types first and not check argument number. >> >> So I wonder which way is the best to proceed here. Looks like this comes >> from 5.6 where internal function types were verified in executor: >> https://github.com/php/php-src/blob/PHP-5.6/Zend/zend_vm_def.h#L1974 >> >> I'm not sure what to do with it - on one side, I think ZPP should handle >> it for internal functions, otherwise we're doing the same work twice. On >> the other side, that would be pretty substantial, even if maybe correct, >> BC break. Should we keep the ZEND_ACC_HAS_TYPE_HINTS type checks and >> accept the fact that this way we're checking everything twice, or should >> be clean it up? > > Is it a BC break against real code though? Fixing tests isn't a big > deal. What kind of real code would break by turning calls with the wrong > number of args from an error to a warning? > > I suppose it is a bit late in the game to fix this, but it really does > seem very broken to the point where I wonder if we shouldn't just > disable reflection on internal functions entirely since the arginfo is > so woefully incomplete. Plus the double-checking is super messy. One thing I really want to work towards in the future is consistency between user-land and internal functions. There are currently multiple observable differences. Maybe it would be best to post-pone these changes until 8.0 where we can do a large consistency pass and handle it then.