Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:81870 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 88432 invoked from network); 5 Feb 2015 08:06:24 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 5 Feb 2015 08:06:24 -0000 Authentication-Results: pb1.pair.com header.from=reeze.xia@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=reeze.xia@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.179 as permitted sender) X-PHP-List-Original-Sender: reeze.xia@gmail.com X-Host-Fingerprint: 74.125.82.179 mail-we0-f179.google.com Received: from [74.125.82.179] ([74.125.82.179:33391] helo=mail-we0-f179.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id F8/C5-51979-C7423D45 for ; Thu, 05 Feb 2015 03:06:23 -0500 Received: by mail-we0-f179.google.com with SMTP id u56so610908wes.10 for ; Thu, 05 Feb 2015 00:06:15 -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=e3KEtOFaNbXWh3MmJEV5D7WgK1FDL/0ZOTpAbDjTON0=; b=zYVyN1ZpPYeaEeEKNqJDk4FPsVnmaNO6F9Tbto3cqvXjOO6R/Z/tnPjs03rQwfZ1/n OYRrGUIcXIU3mz7lGQSfsla9nhIanE1o1FeUgHDVa25p/ntfJbLNj2WiYWcfgg4bFLNu 4GB01OlsL06EaEzzRWaUKRRsASWU/Owjmktml8Rbsh/nN5H66AM36SlUDCKTs79g+wJ8 OrVcGAGCxMIS04dFPvRejph1HR4QMb95FBBZ2VyjzH3wi2VplFAwWHZ0zHCmfHLc/q40 ex/9bWFDfX3kcSwcXzoN36spgSF+3aJczy0KXuaJMbIQRct8CrYZ0/KvZW9MrIUg/jHX 6WGA== X-Received: by 10.194.9.4 with SMTP id v4mr4623500wja.115.1423123575151; Thu, 05 Feb 2015 00:06:15 -0800 (PST) MIME-Version: 1.0 Sender: reeze.xia@gmail.com Received: by 10.195.12.163 with HTTP; Thu, 5 Feb 2015 00:05:54 -0800 (PST) In-Reply-To: References: Date: Thu, 5 Feb 2015 16:05:54 +0800 X-Google-Sender-Auth: 0qrwID4DhizMZYop7_iooQLePAM Message-ID: To: Dmitry Stogov Cc: "internals@lists.php.net" Content-Type: multipart/alternative; boundary=047d7b5d4fe22b22a5050e52c739 Subject: Re: [PHP-DEV] Re: [RFC] Support internal function return types From: reeze@php.net (reeze) --047d7b5d4fe22b22a5050e52c739 Content-Type: text/plain; charset=ISO-8859-1 Thanks a lot! On 5 February 2015 at 16:03, Dmitry Stogov wrote: > merged into master with the proposed changes. > > Thanks. Dmitry. > > On Thu, Feb 5, 2015 at 9:37 AM, reeze wrote: > >> 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 >> > > -- Reeze Xia http://reeze.cn --047d7b5d4fe22b22a5050e52c739--