Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:87856 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 27642 invoked from network); 22 Aug 2015 02:29:24 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 22 Aug 2015 02:29:24 -0000 Authentication-Results: pb1.pair.com header.from=scott@paragonie.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=scott@paragonie.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain paragonie.com from 209.85.212.178 cause and error) X-PHP-List-Original-Sender: scott@paragonie.com X-Host-Fingerprint: 209.85.212.178 mail-wi0-f178.google.com Received: from [209.85.212.178] ([209.85.212.178:34998] helo=mail-wi0-f178.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id D3/65-19109-38ED7D55 for ; Fri, 21 Aug 2015 22:29:23 -0400 Received: by wicne3 with SMTP id ne3so28493273wic.0 for ; Fri, 21 Aug 2015 19:29:19 -0700 (PDT) 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=Ltbc/0cUASKRCX/IrOs5UBPV6bycnEmnlHOaEWD0XWQ=; b=M0LLgSpNVjSqzVifFElZqcqYWiKlONAisMP7lIrHuh7bygy87HLNw2jIftFsChLQcl 6DnI5N/pMw1puQfqRNXjl3fs5Uww7cXsdO7wznPMMneMX83lBU85h8n5spP0MF9FBGpJ xNUSZ0v+7eiRATPgaBsjKT7/I0czH+h/1dFmJOp7j0459ie0FFGG4TgwJXjs2u8Kw1C+ pk0FLHuElPZmrVgrtcRXejtY5kydZ01Od2UzLrPfjqrAApq6mX9w7SJShdBq4Gxd8+kJ giHNt/br4rlhgdF8cGiUuvcQXl8SzSGsF1hhX002QmFmCJHgImIko92k/IRxJvRKrSNo xcMg== X-Gm-Message-State: ALoCoQna/oh98fKXPyFYc8xOqYvvOYxe+1sT6RzdjWarOf+K10r0sDJyWlT1XNOCfGlVPvROrMiI MIME-Version: 1.0 X-Received: by 10.194.117.5 with SMTP id ka5mr20096568wjb.50.1440210559422; Fri, 21 Aug 2015 19:29:19 -0700 (PDT) Received: by 10.28.133.67 with HTTP; Fri, 21 Aug 2015 19:29:19 -0700 (PDT) In-Reply-To: References: <99CE9AAF-E6E9-4D37-B462-E4A63139EAFB@icicle.io> <03af01d0dc6e$fe3a20c0$faae6240$@belski.net> Date: Fri, 21 Aug 2015 22:29:19 -0400 Message-ID: To: Anthony Ferrara Cc: Pierre Joye , Anatol Belski , Niklas Keller , Trevor Suarez , PHP internals Content-Type: text/plain; charset=UTF-8 Subject: Re: [PHP-DEV] Recap - Core functions throwing exceptions in PHP7 From: scott@paragonie.com (Scott Arciszewski) On Fri, Aug 21, 2015 at 10:16 PM, Anthony Ferrara wrote: > > Pierre > > On Aug 21, 2015 22:01, "Pierre Joye" wrote: > > > > On Sat, Aug 22, 2015 at 8:43 AM, Anthony Ferrara wrote: > > > Anatol, > > > > > > On Aug 21, 2015 8:10 PM, "Anatol Belski" wrote: > > >> > > >> Hi, > > >> > > >> > -----Original Message----- > > >> > From: Anthony Ferrara [mailto:ircmaxell@gmail.com] > > >> > Sent: Friday, August 21, 2015 3:37 PM > > >> > To: Scott Arciszewski > > >> > Cc: Pierre Joye ; Trevor Suarez > > >> > ; > > >> > Niklas Keller ; PHP Internals > > >> > Subject: Re: [PHP-DEV] Recap - Core functions throwing exceptions in > > >> > PHP7 > > >> > > > >> > On Fri, Aug 21, 2015 at 6:14 AM, Scott Arciszewski > > >> > wrote: > > >> > > On Fri, Aug 21, 2015 at 3:52 AM, Pierre Joye > > >> > > wrote: > > >> > >> On Fri, Aug 21, 2015 at 9:38 AM, Scott Arciszewski > > >> > >> > > >> > wrote: > > >> > >>> On Wed, Aug 19, 2015 at 11:36 AM, Trevor Suarez > > >> > wrote: > > >> > >>>> Ah, I didn't realize this thread existed. I had just commented on > > >> > >>>> the old one, but the point still stands: > > >> > >>>> > > >> > >>>> PHP 7.0 RC1 was just tagged. > > >> > >>>> Shouldn't this be a relatively high priority to fix/decide so we > > >> > >>>> don't end up with behavior that can't be fixed until PHP 8.0? > > >> > >>>> > > >> > >>>> On Mon, Aug 10, 2015 at 6:54 PM Niklas Keller > > >> > >>>> wrote: > > >> > >>>>> > > >> > >>>>> > > > >> > >>>>> > Okay, great, we have people on both sides on this discussion. I > > >> > >>>>> > hope nobody minds if I sit this part out. > > >> > >>>>> > > > >> > >>>>> > What specifics need to be discussed? Should somebody set up a > > >> > >>>>> > poll? (I don't know how to do that.) > > >> > >>>>> > > >> > >>>>> > > >> > >>>>> You can find information on how to setup a poll in step 6 here: > > >> > >>>>> https://wiki.php.net/rfc/howto > > >> > >>>>> > > >> > >>>>> Regards, Niklas > > >> > >>> > > >> > >>> I agree that this should be a relatively high priority. I'm not sure > > >> > >>> what the next steps would be. (Aside: I still have a PR I need to > > >> > >>> write that I've been holding off on until the fate of PHP 7's CSPRNG > > >> > >>> feature is determined.) > > >> > >>> > > >> > >>> Can we reach some sort of consensus on throw new Exception vs throw > > >> > new Error? > > >> > >> > > >> > >> I think the best would be a RFC, not only for the decision itself but > > >> > >> also to have a clear view about what will be changed or affected. > > >> > >> > > >> > >> Cheers, > > >> > >> -- > > >> > >> Pierre > > >> > >> > > >> > >> @pierrejoye | http://www.libgd.org > > >> > > > > >> > > Fine, let's do this: > > >> > > > > >> > > 1. Violate the feature freeze for this exceptional decision. > > >> > > 2. One of the folks in the camp that WANTS an RFC and a drawn out > > >> > > formal decision-making process opens it with a poll. > > >> > > 3. Give me voting karma. > > >> > > > > >> > > Let's NOT make the CSPRNG feature fail open. That is an absolutely > > >> > > terrible idea. > > >> > > > >> > My proposal/stance: > > >> > > > >> > Let's make random_* throw an Exception if it cannot connect to a random > > >> > source. And let's have it throw an TypeError if ZPP fails, or Error if > > >> > min >= max. > > >> > > > >> > The first two are consistent with existing exceptions. > > >> > > > >> > The third (Error if min>max) is where the contention lies. I'm > > >> > suggesting Error as > > >> > it's consistent with parameter errors in the sense that the type may be > > >> > correct, > > >> > but the value isn't (hence it's the same kind of error as a parameter > > >> > error, just a > > >> > different sub-classification. > > >> > > > >> > MHO is this is too important of a distinction to simply gloss over. > > >> > Having it return false (or null) will be a problem, as nobody will > > >> > perform the error > > >> > checks. And returning $x where `$x == 0` in a security context could be > > >> > incredibly > > >> > bad. As such, I think the security implications here outweigh nearly all > > >> > of the > > >> > other concerns about consistency and convention. > > >> > > > >> > That's my opinion. I'll be happy to make the changes if a RM gives me > > >> > the green > > >> > light to do so. > > >> > > > >> The change being proposed was discussed once more in the RM circle and is > > >> being seen as inappropriate. > > >> > > >> The CSPRNG RFC and the implementation was voted. The change being proposed > > >> amends the paradigm of the current language behavior. Currently no effort > > >> has been done do discuss and work out the paradigm change. > > >> > > >> By today's terms, there are other functions which could require throwing > > >> instead of returning false for security reasons. Security being over BC was > > >> and is even in the patch versions, however how it is handled is related to > > >> the hard and deeply internal cases like memory corruption, etc. Having a > > >> decision that a return value is something security related has impact to the > > >> existing behavior. Having different technical requirements to the congeneric > > >> cases on the language level brings inconsistency. Producing inconsistent > > >> behaviors by one case, without any evaluation and clear course for other > > >> cases, without respecting the votes and code freeze is alarming. > > >> > > >> The current timeline doesn't allow for a proper solution of this topic in > > >> 7.0. The RMs recommendation is that everyone expressing a strong support in > > >> this thread for the behavior change either for core functions in general or > > >> particularly in the security context stands up for a proper solution in 7.1. > > >> If no one believes that a proper solution can exist in 7.1, then an > > >> inconsistency shouldn't exist in 7.0, except the community wants it to be so > > >> which brings it back to an RFC. With respect to everyone who voted on the > > >> original implementation of CSPRNG RFC and everyone else regarding the topic > > >> "throwing in the core functions" it should be accepted in the usual ways > > >> that are foreseen. > > > > > > Thank you for sharing your thoughts and being transparent. > > > > > > There is one tiny thing I would point out though (which likely makes no > > > difference). When the random rfc was voted on, engine exceptions was not > > > accepted. It was a conscious decision by the contributors to not have the > > > function throw because nothing throws in core. That changed with the later > > > rfc. Hence why this was reopened. > > > > > > The discussion has been biked shedded to death. From before beta1. And > > > unfortunately it looks like it has just been bike shedded out of contention > > > for 7.0, which is sad on many levels. > > > > > > But this is where we are today. While I think it is less than optimal, so be > > > it. > > > > I do think as well it is better to solve this question for 7.0. It is > > a kind of big thing even the code changes may be small. Dealing with > > that for 7.1 and 7.0 will most likely be painful. > > > > However we have chosen to have a short timeline to release 7.0. We > > knew the risks of having such issues to solve. I personally would not > > mind too much to have a RFC for this case as long as it includes an > > option to slightly delay 7.0 if necessary. > > If that's what it will take I will happily draft one tomorrow morning. But if the RMs are against it, I will respect that as well. Hence the dilemma. > > Anthony For the sake of compatibility, I'll make the necessary changes to random_compat tonight. Scott Arciszewski Chief Development Officer Paragon Initiative Enterprises