Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:87179 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 12776 invoked from network); 15 Jul 2015 11:20:52 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 15 Jul 2015 11:20:52 -0000 Authentication-Results: pb1.pair.com smtp.mail=yohgaki@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=yohgaki@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.160.177 as permitted sender) X-PHP-List-Original-Sender: yohgaki@gmail.com X-Host-Fingerprint: 209.85.160.177 mail-yk0-f177.google.com Received: from [209.85.160.177] ([209.85.160.177:32856] helo=mail-yk0-f177.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 05/32-27477-31246A55 for ; Wed, 15 Jul 2015 07:20:51 -0400 Received: by ykeo3 with SMTP id o3so32997221yke.0 for ; Wed, 15 Jul 2015 04:20:48 -0700 (PDT) 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=ktVUxqkWwml257NECuSi3rZzmRC39FppYij8YG8TXcY=; b=sgQBAy6HnfgVxLtT/lGC3OvflCrsrZdAe/920sLoqTOPCQsdc3lXCZOaSHiH5R/AEn 37ur64qB2HPCPkbb4SpTHwknQmapAaBctn4P4bQieIAq77cqadfdtb2VsdWcbhKD6FGT XrWdDTy22Bsm9G6ZYca/rt5lyT5ULtP82hP8+GhvBsss7wZI8hSNliYox06Nam9XmB+q ubhK4+Ep+6/2zouG/0TIqAno2QHPzo5/RyXNTh1kGPFA3DrJwXcyONokJwAnWdg/jMNJ BNP0sn5kuXkjuXSFlXECvrGgf7L19YFcuAKNIzMaiQ225iDhtUAgAD98IUYxlbwQUfer 6cDQ== X-Received: by 10.13.216.210 with SMTP id a201mr3617820ywe.89.1436959248334; Wed, 15 Jul 2015 04:20:48 -0700 (PDT) MIME-Version: 1.0 Sender: yohgaki@gmail.com Received: by 10.129.40.77 with HTTP; Wed, 15 Jul 2015 04:20:08 -0700 (PDT) In-Reply-To: <55A63C90.8000705@gmail.com> References: <55A63C90.8000705@gmail.com> Date: Wed, 15 Jul 2015 20:20:08 +0900 X-Google-Sender-Auth: DEZ6_erjDfxm_NzSi7wMv2AhzJ8 Message-ID: To: Rowan Collins Cc: "internals@lists.php.net" Content-Type: multipart/alternative; boundary=001a114e4a5c8dc583051ae82573 Subject: Re: [PHP-DEV] Core functions throwing exceptions in PHP7 From: yohgaki@ohgaki.net (Yasuo Ohgaki) --001a114e4a5c8dc583051ae82573 Content-Type: text/plain; charset=UTF-8 Hi Rowan, On Wed, Jul 15, 2015 at 7:57 PM, Rowan Collins wrote: > Sammy Kaye Powers wrote on 14/07/2015 22:04: > >> Since the core functions in PHP don't throw Exceptions, there is debate on >> whether or not this change should be implemented. Some say the CSPRNG's >> should get a special pass since they will be relied on for cryptography. >> If >> we can't throw Exceptions, there were suggestions of raising a fatal error >> if the RNG fails. >> > > Given that the *engine itself* now throws exceptions, and we have bundled > extensions which throw exceptions, the blanket ban on exceptions "in core > functions" seems increasingly out-dated. This particular function is in > ext/standard, which is about as "core" as you can get, but it is a brand > new function with no BC considerations and an explicit mandate to be as > secure as possible. > > To me, using an exception here makes perfect sense, but I'm not sure how > to formulate a policy that allows that without opening the floodgates too > quickly. I'm also a big fan of proper exception hierarchies - I've seen so > many times that you should never *catch* the base Exception class, so > *throwing* a base Exception seems very wrong to me. As I wrote earlier, I prefer exceptions rather than errors. Engine exception is a little different. The main motivation for engine exception is to give a chance to users for graceful program termination. Functions can achieve the objective by E_RECOVERABLE_ERROR mostly. I don't want to see one function raise exception and the other raise error. It's "should be avoided inconsistency". IMHO. If we are going to adopt exception for "functions", it would be better to have switch that convert all errors to exceptions. Regards, -- Yasuo Ohgaki yohgaki@ohgaki.net --001a114e4a5c8dc583051ae82573--