Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:70529 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 48877 invoked from network); 8 Dec 2013 12:51:11 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 8 Dec 2013 12:51:11 -0000 Authentication-Results: pb1.pair.com header.from=jakub.php@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=jakub.php@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.216.169 as permitted sender) X-PHP-List-Original-Sender: jakub.php@gmail.com X-Host-Fingerprint: 209.85.216.169 mail-qc0-f169.google.com Received: from [209.85.216.169] ([209.85.216.169:46826] helo=mail-qc0-f169.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 67/46-01020-E3B64A25 for ; Sun, 08 Dec 2013 07:51:10 -0500 Received: by mail-qc0-f169.google.com with SMTP id r5so1931852qcx.0 for ; Sun, 08 Dec 2013 04:51:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=8Ekz8l0N3IANw1QL1+Pz8QjScjziCeyA6qAYwjHcxNg=; b=uM4mLRGQXolQadtO7tVV75nC9AsCZU5jBkxJ6iz+vWANCrXGIFlb2sg9n9Bp/29Y9u xQXbfDzxfML/hoWcQcGe2jmlKleZktR0q1Ih+WtuDrbaLTzXi3EEiVmdHiJvcmWZTtZW EytgL3aF3zAkP95GShVxQHNqgyFYW9n+wLntzC4wwf/9F3g65Zp8ftkcuWwRblkqsqrq 8Ek/83fKXFf5NK1QLeOvqetnN/24FMbMo3ah8pJdO/UyiJECrVlqnA4AfMCUpNbsalJE 1jX4SdaxIr4reVTFwvUWCa5fIX1WGTDwne9ORxS0mQIOS+uNiE/pA0tAK0WiCUUG2+9b ttww== MIME-Version: 1.0 X-Received: by 10.224.11.7 with SMTP id r7mr134348216qar.91.1386507067680; Sun, 08 Dec 2013 04:51:07 -0800 (PST) Sender: jakub.php@gmail.com Received: by 10.224.39.144 with HTTP; Sun, 8 Dec 2013 04:51:07 -0800 (PST) In-Reply-To: References: Date: Sun, 8 Dec 2013 12:51:07 +0000 X-Google-Sender-Auth: 8OQEONuBlstJF5h2Eid3USf2vI4 Message-ID: To: Nikita Popov Cc: Ferenc Kovacs , PHP internals Content-Type: multipart/alternative; boundary=001a11c2c1263f6b4504ed0555fe Subject: Re: [PHP-DEV] [VOTE] Allowing use of exceptions in the engine From: bukka@php.net (Jakub Zelenka) --001a11c2c1263f6b4504ed0555fe Content-Type: text/plain; charset=ISO-8859-1 On Sun, Dec 8, 2013 at 11:48 AM, Nikita Popov wrote: > On Sat, Dec 7, 2013 at 6:05 PM, Ferenc Kovacs wrote: > > > personally I have seen catch-all blocks in the wild (try {//do something} > > catch(Exception $e) {//do nothing}), which would behave differently (and > > some of them would screw something up instead of terminating the app) if > > the EngineException is a subclass of Exception. > > I can see myself supporting this proposal for 5.6, if we can have it done > > in a truly BC-safe manner, but I can understand, if the required > > compromises for that would make the feature too "clunky", so maybe it > would > > be better to introduce it in a major version. > > > > I'm not sure I see how catch-all blocks relate to BC-safety as far as > E_ERROR is concerned. If an engine exception is accidentally caught by a > catch-all block, it means that previously it was throwing a fatal error, > which means that your code didn't work anyway - in all likeliness you were > getting a WSOD or ISE. The catch-all block will not break the code (it is > already broken), it will only change the way in which it fails (or prevent > it from failing altogether). Of course, unintentionally missing an error > *is* an issue, but it's not an issue of BC. > > Nikita I think that the problem could be code like this: try { // do same stuff } catch (Exception $e) {} delete_something_important(); I haven't tested the patch but from what I read it seems that delete_something_important() would be now called even if there was a fatal error in the try block? In addition there is a small BC break that should be probably mentioned in RFC. All apps with defined EngineException will not work. I actually found one open source app. It's the first version of ORM Propel: https://github.com/propelorm/Propel/blob/master/generator/lib/exception/EngineException.php It looks that it's still used quite a few users (even there is a version 2 that resolved this using ns). I believe that there can be more closed source apps so it should be at least mentioned in RFC... Jakub --001a11c2c1263f6b4504ed0555fe--