Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:98914 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 63244 invoked from network); 29 Apr 2017 20:54:16 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 29 Apr 2017 20:54:16 -0000 Authentication-Results: pb1.pair.com header.from=nikita.ppv@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=nikita.ppv@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.214.49 as permitted sender) X-PHP-List-Original-Sender: nikita.ppv@gmail.com X-Host-Fingerprint: 209.85.214.49 mail-it0-f49.google.com Received: from [209.85.214.49] ([209.85.214.49:37959] helo=mail-it0-f49.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id FD/3A-01540-77DF4095 for ; Sat, 29 Apr 2017 16:54:16 -0400 Received: by mail-it0-f49.google.com with SMTP id e65so10195615ita.1 for ; Sat, 29 Apr 2017 13:54:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=CZFGWCDaC37Pld/wIDwlc1GOw5si/lRkRiRkhbR/Zl8=; b=mVMd8MrZJTMEOyXHF0zdO8+I1qVFU8W+EUhh88EdoQFH++odp8+2+hkh0VxP/gUgw5 xv8UCG2tAZR6F/VvxOw96PjPukh0zUoGP5kLFMVJ/gym9rGJ7VAakBYZEr35gr1906fd OF2ay63l/rZmU+h+vhHv9nKxhsv/4os9iHaeGgZ7BcKBhRSVPqJx3v+O+fNu22A0ocR3 cgGmQ/awJbh4d3cSXJtTLTQqCpheTPeL/52b3cpFB2sR1jmDjMGOVdjfcEYa8+9upQ8J Nzr9o+F2mTtdEAXSSWjJdCN+H2NKyuYQTc2s9k2dyvj9m91aiqCUaNvwiaixwlV7/wxe cLeA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=CZFGWCDaC37Pld/wIDwlc1GOw5si/lRkRiRkhbR/Zl8=; b=SAPKGINHeoez2bUefV5gKpeW4Ee8RGrRgL4m12QFeoQFmG0jBggezAnkTkea1QiWiR fJIWrl8CMULBa/zsZyaCR5AwzRJnAucHzMU3MMruW6mv0X811dDLxzauw9FXa0DERR6C DakE4s++TUTl754AELiAZAHLIJAFvLRR+ehi3oTNyuJkeomOqm5THr68KYfv26yTzFRP h8KM9G6IzkSto0e68EApgnkoAJFW23IClZNpO6xBnEeFmqZjyJ6uGowzYMeHQih0qc4W f5SyvrxJUgGRDjNJHK4FnvwIqkgyHCZdV+AW5YPIqffCdmcXfib4ryhJ/VPo4SJMd5lC folg== X-Gm-Message-State: AN3rC/4gqfdOLNDfVy57ACShnrEwYe1/0NMmH/YsG2geDoalakjuQvXe eJVAL7iVMYKy7B9R5W2YgHCtE63LBg== X-Received: by 10.36.190.205 with SMTP id i196mr15885950itf.88.1493499253473; Sat, 29 Apr 2017 13:54:13 -0700 (PDT) MIME-Version: 1.0 Received: by 10.107.9.144 with HTTP; Sat, 29 Apr 2017 13:54:13 -0700 (PDT) In-Reply-To: References: Date: Sat, 29 Apr 2017 22:54:13 +0200 Message-ID: To: Sara Golemon Cc: PHP internals Content-Type: multipart/alternative; boundary=94eb2c0344f079cd40054e546451 Subject: Re: [PHP-DEV] ZEND_ARG_TYPE_INFO usage in core? From: nikita.ppv@gmail.com (Nikita Popov) --94eb2c0344f079cd40054e546451 Content-Type: text/plain; charset=UTF-8 On Sat, Apr 29, 2017 at 10:24 PM, Sara Golemon wrote: > Spinning off a sub-thread: Does anyone know any particular reason why > ZEND_ARG_TYPE_INFO is not (barring two windows specific functions in > standard) used anywhere in core? > > Is it? > 1. Nobody has done the grunt work since 7.0? > 2. It breaks something? (should only impact reflection AIUI) > 3. ??? > > I'd be happy to put in the grunt work on standard, hash, and intl at > the very least. > > -Sara > There are a number of reasons why this hasn't happened yet: 1. In weak mode, arginfo type violations throw, while zpp violations warn and return NULL. As such, adding arginfo types to existing functions is a BC break. 2. For methods in particular, prior to PHP 7.2, adding arginfo types was also a BC break. This is no longer the case, as variance is now respected. 3. Arginfo types for internal functions are enforced by the runtime. Because the types are already checked by zpp, this is an unnecessary duplicate check. Additionally, type-checking for internal functions is on the slow-path (to the point there it uses a different opcode). While of course this doesn't matter for some functions, in other cases type checking / parameter parsing is the main overhead of a function (which is why fast zpp was introduced in the first place). I'm sure we do not want to have decisions on whether to add or not add arginfo for a particular function based on whether it would have a significant performance impact. The solution to these problems is simple: Stop checking arginfo types for internal functions, just use them for reflection / inheritance checks, but leave the actual type-checking to zpp. However, this doing this will also change current behavior due to point (1.), as in weak-mode some type errors that are currently throwing would be reduced to warn + null. Personally I don't have a problem with that, as I'd consider this a compatible change, and it would make type-checking for internal functions consistent. Nikita --94eb2c0344f079cd40054e546451--