Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:87463 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 13162 invoked from network); 31 Jul 2015 22:21:02 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 31 Jul 2015 22:21:02 -0000 Authentication-Results: pb1.pair.com header.from=me@kelunik.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=me@kelunik.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain kelunik.com from 81.169.146.216 cause and error) X-PHP-List-Original-Sender: me@kelunik.com X-Host-Fingerprint: 81.169.146.216 mo4-p00-ob.smtp.rzone.de Received: from [81.169.146.216] ([81.169.146.216:28680] helo=mo4-p00-ob.smtp.rzone.de) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 4C/44-24609-CC4FBB55 for ; Fri, 31 Jul 2015 18:21:01 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1438381257; l=5325; s=domk; d=kelunik.com; h=Content-Type:Cc:To:From:Subject:Date:References:In-Reply-To: MIME-Version; bh=mw/E4T2UecganEQ0YYjDy4JhTNrBdEBtm/980tOu+dc=; b=jK2mSi3EVvkD/hSaQuYwmO2tn7ckgNM/zwYPed/aE2qlkJpoiC3sy/CmuIvo8b4+bGO MEPXZy2L33dNwNkf6cyu/X/wpiJpPMwZBqEDz0ImsZYx55GaqJv0mDEs2i3xBwL0gRjWH Ki3V+q7LNib0BMj3DU1yaRGh5Kud+ZWRTj4= X-RZG-AUTH: :IWkkfkWkbvHsXQGmRYmUo9mls2vWuiu+7SLDup6E67mzuoNNBqD+uQw= X-RZG-CLASS-ID: mo00 Received: from mail-wi0-f169.google.com ([209.85.212.169]) by smtp.strato.de (RZmta 37.8 AUTH) with ESMTPSA id z04ffer6VMKv97D (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA (curve secp521r1 with 521 ECDH bits, eq. 15360 bits RSA)) (Client did not present a certificate) for ; Sat, 1 Aug 2015 00:20:57 +0200 (CEST) Received: by wibxm9 with SMTP id xm9so51088032wib.0 for ; Fri, 31 Jul 2015 15:20:57 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.180.20.71 with SMTP id l7mr11632459wie.32.1438381257562; Fri, 31 Jul 2015 15:20:57 -0700 (PDT) Received: by 10.27.204.197 with HTTP; Fri, 31 Jul 2015 15:20:57 -0700 (PDT) In-Reply-To: References: <836BA21C-AE99-4E7B-AB06-EBC30E41BA0E@icicle.io> <0AD335F5-35F3-4D98-8F82-800A1EDF8FD8@icicle.io> <05f101d0c838$fcdab5e0$f69021a0$@belski.net> <55B63FDF.6050100@gmail.com> <55B66494.1020106@gmail.com> <55B6707A.3040405@gmail.com> Date: Sat, 1 Aug 2015 00:20:57 +0200 Message-ID: To: Yasuo Ohgaki Cc: Scott Arciszewski , Rowan Collins , Anthony Ferrara , PHP Internals Content-Type: multipart/alternative; boundary=bcaec53f2e27e8a317051c333bd0 Subject: Re: [PHP-DEV] Core functions throwing exceptions in PHP7 From: me@kelunik.com (Niklas Keller) --bcaec53f2e27e8a317051c333bd0 Content-Type: text/plain; charset=UTF-8 2015-07-31 23:36 GMT+02:00 Yasuo Ohgaki : > Hi Niklas, > > On Fri, Jul 31, 2015 at 7:20 PM, Niklas Keller wrote: > >> Using set_error_handler isn't handling errors gracefully. Well, it's >> better than E_ERROR, but then libraries can't handle those errors >> gracefully, because the user might override its error handler by setting an >> own handler. > > > Now I see what do you mean by "gracefully". > > TL;DR; > It's app developer jobs to handle these fatal errors. > Nope. > Most fatal errors shouldn't be recovered by library. e.g. Fallback to non > CSPRNG when CSPRNG is not > available. > They should totally be handled. You need to catch the error and throw a defined exception, otherwise your public API will break if you choose to use another internal implementation. Additionally, you seem to assume that the library doesn't have to do things like cleanups in such a case. Regards, Niklas > IMO, library authors do not have to worry about errors like session's > E_RECOVERABLE_ERROR > or CSPRNG not available. These are fatal errors by its nature and app > developer or system administrator > job to handle them. We cannot blindly assume such fatal errors never > happen in production apps, so we > are better to give users a chance to return "Nice error page/message" when > it happened. > > Anyway, we are better to move errors to exceptions at once and force "all" > modules including 3rd party > module to raise exceptions. i.e. Make php_error_docref() raise exceptions. > > Regards, > > -- > Yasuo Ohgaki > yohgaki@ohgaki.net > --bcaec53f2e27e8a317051c333bd0--