Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:94503 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 60943 invoked from network); 13 Jul 2016 20:29:09 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 13 Jul 2016 20:29:09 -0000 Authentication-Results: pb1.pair.com header.from=nikita.ppv@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=nikita.ppv@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.161.176 as permitted sender) X-PHP-List-Original-Sender: nikita.ppv@gmail.com X-Host-Fingerprint: 209.85.161.176 mail-yw0-f176.google.com Received: from [209.85.161.176] ([209.85.161.176:33751] helo=mail-yw0-f176.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 86/95-10509-494A6875 for ; Wed, 13 Jul 2016 16:29:09 -0400 Received: by mail-yw0-f176.google.com with SMTP id j17so54923002ywg.0 for ; Wed, 13 Jul 2016 13:29:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=Vye9wu7muw9Z6ruNLVNVeeFU8DeQUhUb9ZaFsNjJT34=; b=bBNtzvKgsK6GEO2Yt6M4oH6eUWISSxJ2QkVn7uczhs7IN8Vhe8qitVrAzNRMA7WbY0 q0YkhsJg+UAIteAp+bOw/Ur5PfGixiwyzi+oPLMBZSNpNeIGDutO7AqRj3Pkk2DhfG0T MXgIJretF9oMgWYP5JRCE0iucC7hGzb/RyOsCE0eaPML3bmq04f+Ea4DmJf9N21htkXe YerFjp5LeVb7qjRvQcsOC+aNKblmsHaAVlTEj5Tcl40SgfsKRc9WWjy542KemTc3q7g7 bPElsuxUASVphrwzJqmcMSs1BpH5yqqhJyBLwqXTlJT+5WrYriRfJfKeQKvApiHaqa+T TFtw== 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:from:date :message-id:subject:to:cc; bh=Vye9wu7muw9Z6ruNLVNVeeFU8DeQUhUb9ZaFsNjJT34=; b=Z61e86o1AMXnW1DpeNkzA8fy8xw7G3FN9kO+QoA0FO8w1UbnjSq4nt7vzseNIJ9Xpq ju7HllTG6zskriWk9alyGkA/Nfpq7i8eZscEX4H2UEdHlQeUeFec8B0ugROp3/FozhoW uIrh+9h77fnEu6LeMPDo+XdkuBWi/bX6/SnElBZK6E9thqnyBuaStmH/HmN9jQZmic30 PtAsNY4sd7bQo51qifMZB2BiuXgdjINpEeOBgdfDjL4noTwpq+yDRaCLeGkGwu13UpP4 pG1HXlRNcLrVKaMOfCqmB8yBxFNR+dlrGhZmk5kZwC4PXxipCXUCeJLBLAwMJRKoLqId gfjg== X-Gm-Message-State: ALyK8tJ4+l7efPOAVma7QlSURWoWsX8CqZgJNzg8coV1L8nkJYzuWBekwxSQKI600HgFBE+ORzlJBQiGXD4f0w== X-Received: by 10.37.202.19 with SMTP id a19mr7190807ybg.61.1468441745633; Wed, 13 Jul 2016 13:29:05 -0700 (PDT) MIME-Version: 1.0 Received: by 10.129.131.129 with HTTP; Wed, 13 Jul 2016 13:29:05 -0700 (PDT) In-Reply-To: References: <2c547cd2-408d-238b-2b5c-e6f7f24f0e7a@fleshgrinder.com> Date: Wed, 13 Jul 2016 22:29:05 +0200 Message-ID: To: Stanislav Malyshev Cc: PHP internals Content-Type: multipart/alternative; boundary=94eb2c05b1d09f387205378a3cf1 Subject: Re: [PHP-DEV] [RFC DISCUSSION] Error Storage Behavior From: nikita.ppv@gmail.com (Nikita Popov) --94eb2c05b1d09f387205378a3cf1 Content-Type: text/plain; charset=UTF-8 On Mon, Jun 27, 2016 at 9:53 PM, Stanislav Malyshev wrote: > Hi! > > > Currently error_get_last() always contains the last error that occurred, > > however, this is actually not desired if the last error was an exception > > that was caught. > > > > https://github.com/php/php-src/pull/1936 > > I think conditioning warnings on whether exception is caught or not is a > very bad idea. However, having _either_ exception _or_ PHP error and not > producing both (except in the case where uncaught exception becomes > fatal error I guess) may be a good idea, but it needs careful checking > of the implications. In general, old error mechanism and exceptions are > not very good combination, and using them together may be troublesome. > > It's definitely not "just a bug fix" - it needs careful check of what > exactly happens when. > I think there is some confusion about this change because the description was unclear. The change is **only** about EH_THROW handling. EH_THROW is used by extensions to replace warnings etc with exceptions. Currently the exception is thrown, but error_get_last() still behaves as if the warning was thrown instead. Fixing this does seem like a normal bug fix to me. Note that this does not touch exceptions thrown from error handlers or similar in any way. Basically the problem is that an extension using zend_throw_exception directly and an exception throwing through EH_THROW will behave differently, while there should be no difference. The part about behavior being dependent on whether you catch the exception or not: This is true only insofar as an uncaught exception generates a fatal error and that fatal error is retrievable through error_get_last(). There is no special casing occurring here. Nikita --94eb2c05b1d09f387205378a3cf1--