Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:81864 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 75100 invoked from network); 5 Feb 2015 06:32:00 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 5 Feb 2015 06:32:00 -0000 Authentication-Results: pb1.pair.com smtp.mail=dmitry@zend.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=dmitry@zend.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain zend.com designates 209.85.220.169 as permitted sender) X-PHP-List-Original-Sender: dmitry@zend.com X-Host-Fingerprint: 209.85.220.169 mail-vc0-f169.google.com Received: from [209.85.220.169] ([209.85.220.169:58363] helo=mail-vc0-f169.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 2D/53-51979-F5E03D45 for ; Thu, 05 Feb 2015 01:31:59 -0500 Received: by mail-vc0-f169.google.com with SMTP id hq12so2153108vcb.0 for ; Wed, 04 Feb 2015 22:31:56 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=o/LkKtxqrGChkBj6sXRY0peguzjp4Cvq3Ct4pL3kXkc=; b=gF5DrgcdCDShodU4g8oyyfj0dsx0ooiFn1b3tZEVjpUMnbCiWM8r06iVIXasZHmtXM U3ZOdPyjpQ33kAfabGfX1yA/ugBTAHsXHyC3d3paRqTTv8491MLgtKlsg7y+ijVKbydH CuFqu3cuazX7JBNQatKKToubNMNq6GmGR/UzhZcKShBqfKKfS/kb1JxJHwweg7WTP/rP IkrytSY7s7f88uglVsXrBS0tW3FLtd6ICst35ieiN/aokiQ9Rvm/X+0wN70LsaOtOqYD 1WUW8CdF+Y03khpwNNrjBNN7+WheYJKW43VsOWDGHrouzlq5sCSEg6aWZCdHyqSsQUna UhFg== X-Gm-Message-State: ALoCoQnAYAjumJ0VN/CvITRF7XG2JCP0OzmrbOXDffpyyk66mr4e+ZgK8R9YFOTfDeAPqoYGY/VIDnxaebnXpf7xuCEnX1Q9AXnSM6ocavyF6eXU6JmLBvwXY7DEMSdBrqBaCc79ETnuY4GifsFAHdc5TA8N2Ez30w== MIME-Version: 1.0 X-Received: by 10.52.103.75 with SMTP id fu11mr1210073vdb.5.1423117916646; Wed, 04 Feb 2015 22:31:56 -0800 (PST) Received: by 10.52.74.73 with HTTP; Wed, 4 Feb 2015 22:31:56 -0800 (PST) In-Reply-To: References: Date: Thu, 5 Feb 2015 10:31:56 +0400 Message-ID: To: reeze Cc: "internals@lists.php.net" Content-Type: multipart/alternative; boundary=047d7b86d990e54802050e5175e3 Subject: Re: [PHP-DEV] Re: [RFC] Support internal function return types From: dmitry@zend.com (Dmitry Stogov) --047d7b86d990e54802050e5175e3 Content-Type: text/plain; charset=UTF-8 Hi reeze, The original "return type" patch was designed to support internal functions as well. So I think, this is just a good addition. 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. 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 > > > --047d7b86d990e54802050e5175e3--