Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:82941 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 72902 invoked from network); 17 Feb 2015 10:21:47 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 17 Feb 2015 10:21:47 -0000 Authentication-Results: pb1.pair.com header.from=kontakt@beberlei.de; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=kontakt@beberlei.de; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain beberlei.de from 209.85.212.180 cause and error) X-PHP-List-Original-Sender: kontakt@beberlei.de X-Host-Fingerprint: 209.85.212.180 mail-wi0-f180.google.com Received: from [209.85.212.180] ([209.85.212.180:36447] helo=mail-wi0-f180.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 59/D0-01961-A3613E45 for ; Tue, 17 Feb 2015 05:21:47 -0500 Received: by mail-wi0-f180.google.com with SMTP id h11so31899824wiw.1 for ; Tue, 17 Feb 2015 02:21:43 -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=2a1tqDb2KwkD6VbskRModtU4fTUvW/EA6OesnKluooM=; b=CtWNNi69gnEwQxjmJjK5OgdthRPv3yl/D8CRdAseZnt2NFmmXNJtNI9AxHAugbCEKW j1ho4cmVk5NummVtOy/DE8f7eANz2PTUuZj0N4+IF+lP+1iHmsZ4ffe39dIlYAoR8h+k JAcpiN4rAJjjhkgvwwJLERW6fId0Un1TnIIHV6CL4aE86KGEhZnUmvD6cxwEq8RXmnBa a6M60n14UOJ7d9cnTdiKvwwRBacfSuKVk3trcxqPhdgsmGeyQuCoQoXGUkyiLK1JtoeO uavOU9KlP+eixu10XGlDLRFtCMOZruFElJCT47S22HDAUgYGcE15xGrwb4ZqGYJV4gvY k6iw== X-Gm-Message-State: ALoCoQlQjYkMrgQ/+c0ItXuR28uWxufFzdpAi2blFCNQpwJxwuvXnQ+4rpW1YLQJgM99c1cIOeft MIME-Version: 1.0 X-Received: by 10.194.185.9 with SMTP id ey9mr46002193wjc.135.1424168503163; Tue, 17 Feb 2015 02:21:43 -0800 (PST) Received: by 10.194.192.202 with HTTP; Tue, 17 Feb 2015 02:21:43 -0800 (PST) X-Originating-IP: [93.129.120.219] In-Reply-To: References: Date: Tue, 17 Feb 2015 11:21:43 +0100 Message-ID: To: Bob Weinand Cc: Nikita Popov , PHP internals Content-Type: multipart/alternative; boundary=047d7bd6adcebb544c050f461153 Subject: Re: [PHP-DEV] [RFC] Exceptions in the engine From: kontakt@beberlei.de (Benjamin Eberlei) --047d7bd6adcebb544c050f461153 Content-Type: text/plain; charset=UTF-8 On Tue, Feb 17, 2015 at 11:14 AM, Bob Weinand wrote: > > Am 14.02.2015 um 00:25 schrieb Nikita Popov : > > > > On Mon, Oct 6, 2014 at 11:53 PM, Nikita Popov > wrote: > > > >> Hi internals! > >> > >> During the PHP 5.6 development cycle I have proposed an RFC [1] that > >> suggested the use of exceptions instead of fatal errors in the engine. > At > >> the time the proposal was declined, because the change was judged too > >> intrusive for a minor version. > >> > >> As such I'm re-proposing this RFC for inclusion in PHP 7: > >> > >> https://wiki.php.net/rfc/engine_exceptions_for_php7 > >> > >> The RFC text is essentially the same as previously, with the primary > >> difference being that parse errors are now converted to exceptions as > well. > >> This was previously not possible due to limitations in the compiler > design. > >> > >> Thanks, > >> Nikita > >> > >> [1]: https://wiki.php.net/rfc/engine_exceptions > >> > > > > Feature freeze is not so far away now, so I'd like to bring this RFC up > > again and proceed to voting shortly. There are two primary open > questions: > > > > * Subclassing: Should there be more specific subclasses of > EngineException > > for particular errors? > > * Superclassing: Should EngineException inherit from Exception (and as > > such be subject to catch(Exception)) or should we introduce some kind of > > special super-class that is not caught by default (like > > Catchable/Throwable)? > > > > I don't think we can implement a high-quality subclassing scheme in a > > timeframe for PHP 7, as such I would suggest to postpone this (if we > > actually want to do it) to a later point in time. We can introduce > > subclasses without BC issues in a minor version. > > > > The question of whether EngineException should inherit from Exception is > > something we do have to consider now. Personally I prefer not introducing > > any special exception types that aren't caught by default. I think that > > would only make sense for errors that could occur literally everywhere > > (like memory limit or timeout), but these are not handled by this RFC for > > technical reasons. If someone has a strong opinion on this, I might make > it > > a voting option. > > > > Commentary on these, and also any other relevant points is very welcome! > > > > Thanks, > > Nikita > > > > PS: The patch attached to the RFC is very outdated. I plan to only update > > it to current master once the RFC passes (if it does), as I already had > to > > practically rewrite it a few times. > > Hey, > > For subclassing I totally agree that we should postpone this (if we want > this at all). > > I think EngineException should inherit from Exception. You usually only > catch Exception in catch-all handlers to display, log etc. the backtraces. > In all these cases, you're very likely to want to catch the EngineException > too, without a second catch block where the catch body is duplicated. > I can't really think of a catch-all block where you'd explicitly don't > want to handle EngineException. And if it'd really be the case, you still > can do an instanceof check and rethrow if needed... > I think that would be a huge BC break. I see a lot of code just catching \Exception at various customers and opensource projects. EngineException should not be a child of Exception. > > Thanks, > Bob > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > --047d7bd6adcebb544c050f461153--