Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:81869 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 86905 invoked from network); 5 Feb 2015 08:03:56 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 5 Feb 2015 08:03:56 -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.172 as permitted sender) X-PHP-List-Original-Sender: dmitry@zend.com X-Host-Fingerprint: 209.85.220.172 mail-vc0-f172.google.com Received: from [209.85.220.172] ([209.85.220.172:49685] helo=mail-vc0-f172.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 61/75-51979-7E323D45 for ; Thu, 05 Feb 2015 03:03:55 -0500 Received: by mail-vc0-f172.google.com with SMTP id le20so2259322vcb.3 for ; Thu, 05 Feb 2015 00:03:42 -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=+mRIn6f9iWI6VSacIwLpwT/Wv7kcRTf+oUqCnAie89U=; b=P1Ei3AW2HoMzOV/CiMjA5LYDdA84JSQUw2g/+o31YmXgMYdOfTCKHOBBmYnAWybit0 mhA86IvBiWZ4DnaNbdaG/OWtmNS/VHiIcoMymmbpD9Y1ZDWyo87gSbDi9Iuxi30nw+jm cHUw7dLefG+T1ssFcJN8j6Ttd5049q2jjBF4vkgqV1s4o68EIp4soWz96pW5zzOh/cc7 JP18GHSBvZ8QKrR0UYGHH9X0trcUsFmaIjseE7keygaxbQalyAft1CmmsHSZa2QXAJlY St9vqyT51EJRPsxOa+rvO95qsdcBsFc5X1cjrroUbIcisR12vlUG6c+1ptcxyH9uXW15 bklA== X-Gm-Message-State: ALoCoQkXotLj7pF6+4/ek+U9QQde7TUwzmQibqKNQmac8SCTVdSOaE6t60sk4RvCTihPyuS04NkyNTPUx2BdEv07dO2hmA94RQTb4eNw0nM+9k7QEdSAudMmouEpHyFQItDwsLUM6jFXbXmtx+L/DLpxRNBUUbwrrg== MIME-Version: 1.0 X-Received: by 10.221.18.136 with SMTP id qg8mr920477vcb.27.1423123421974; Thu, 05 Feb 2015 00:03:41 -0800 (PST) Received: by 10.52.74.73 with HTTP; Thu, 5 Feb 2015 00:03:41 -0800 (PST) In-Reply-To: References: Date: Thu, 5 Feb 2015 12:03:41 +0400 Message-ID: To: reeze Cc: "internals@lists.php.net" Content-Type: multipart/alternative; boundary=001a113399e60a23ce050e52be0c Subject: Re: [PHP-DEV] Re: [RFC] Support internal function return types From: dmitry@zend.com (Dmitry Stogov) --001a113399e60a23ce050e52be0c Content-Type: text/plain; charset=UTF-8 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 > --001a113399e60a23ce050e52be0c--