Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:81865 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 76709 invoked from network); 5 Feb 2015 06:37:36 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 5 Feb 2015 06:37:36 -0000 Authentication-Results: pb1.pair.com smtp.mail=reeze.xia@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=reeze.xia@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.212.178 as permitted sender) X-PHP-List-Original-Sender: reeze.xia@gmail.com X-Host-Fingerprint: 209.85.212.178 mail-wi0-f178.google.com Received: from [209.85.212.178] ([209.85.212.178:47131] helo=mail-wi0-f178.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id D4/B3-51979-FAF03D45 for ; Thu, 05 Feb 2015 01:37:35 -0500 Received: by mail-wi0-f178.google.com with SMTP id bs8so8302174wib.5 for ; Wed, 04 Feb 2015 22:37:31 -0800 (PST) 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-type; bh=QjXSmTMCCj658Po0rn2l9tMFgSpe0LFNb2e5RdxrwJw=; b=N/2l6hNb1aUEWo5Ofyttahmna9nT6XRnz8TbfBZ4p/MHaaEoOw90Cy/Pyqo4k4VvI6 cvmVPPJqKgaL5E0JkUhNYg5YzF9O+SEpoFA2a3K6rV61LXxYummGrwLPCvfb8do/CrTK NSGOPZBUzJLw/ALXg0xWn5wIJxmAv02dyMbLMg6LTWei9NjXu1BlQhnIYN42Z5UZiNxk yunZQRw1EuXl0GKBuLioP8bWwTimjjqN84X1XNAnLqKyr35P22nKPzQ80ldXqBmUkdaq 51laDTqBwpuHjHfK6lqJopR87fNoU1tiDLxODz1inOjsng9drxHwf6ksc20gzIi335bp ztwg== X-Received: by 10.181.11.136 with SMTP id ei8mr11780220wid.71.1423118251628; Wed, 04 Feb 2015 22:37:31 -0800 (PST) MIME-Version: 1.0 Sender: reeze.xia@gmail.com Received: by 10.195.12.163 with HTTP; Wed, 4 Feb 2015 22:37:11 -0800 (PST) In-Reply-To: References: Date: Thu, 5 Feb 2015 14:37:11 +0800 X-Google-Sender-Auth: n1eBdokneQLAQ_pZC32xC5nzL3E Message-ID: To: Dmitry Stogov Cc: "internals@lists.php.net" Content-Type: multipart/alternative; boundary=f46d043bdfcadca0b6050e518981 Subject: Re: [PHP-DEV] Re: [RFC] Support internal function return types From: reeze@php.net (reeze) --f46d043bdfcadca0b6050e518981 Content-Type: text/plain; charset=ISO-8859-1 Hi Dmitry, On 5 February 2015 at 14:31, Dmitry Stogov wrote: > Hi reeze, > > The original "return type" patch was designed to support internal > functions as well. > So I think, this is just a good addition. > Yes :) > > Only one note: > I'm not sure, if we need the addition check in ZEND_DO_FCALL handler. > On one hand it verifies that internal function returns proper result (but > they MUST do it). > On the other hand, it also slowdowns each additional call. > > Instead of modifying zend_verify_return_type() I would add > zend_verify_internal_return_type(), > and use: ZEND_ASSERT((fbc->common.fn_flags & ZEND_ACC_HAS_RETURN_TYPE) && > zend_verify_internal_return_type(fbc, EX_VAR(opline->result.var))); > > This would allow catching error in DEBUG build, but won't slowdown RELEASE > build. > > If you agree, I may just commit this. > Sure! Thank you! > > Thanks. Dmitry. > > On Thu, Feb 5, 2015 at 7:01 AM, reeze wrote: > >> PS: >> >> There is no enough unit tests to cover all of the branches, if we want >> then >> I have to add a bunch of for testing functions and classes in ZEND_DEBUG, >> what is the better way? >> >> On 5 February 2015 at 11:54, reeze wrote: >> >> > Hi all, >> > >> > RFC: https://wiki.php.net/rfc/internal_function_return_types >> > >> > I noticed that return types RFC[1] didn't support internal functions, I >> > just open a PR[2] to support it. >> > >> > There are some open issues we can discuss: >> > >> > 1. User land return types didn't stop the php, the current >> implementation >> > raise error to stop PHP from start, this may help debug problem. >> > 2. User land return types didn't support Nullable types, but the RFC >> > return types internally support it, I think it is feature. is that >> > acceptable? >> > >> > Thank you. >> > >> > --- >> > >> > [1] https://wiki.php.net/rfc/return_types >> > [2] https://github.com/php/php-src/pull/1050 >> > >> > > -- Reeze Xia http://reeze.cn --f46d043bdfcadca0b6050e518981--