Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:69856 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 62132 invoked from network); 24 Oct 2013 20:16:31 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 24 Oct 2013 20:16:31 -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.214.172 as permitted sender) X-PHP-List-Original-Sender: nikita.ppv@gmail.com X-Host-Fingerprint: 209.85.214.172 mail-ob0-f172.google.com Received: from [209.85.214.172] ([209.85.214.172:41428] helo=mail-ob0-f172.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 5A/91-10840-E1089625 for ; Thu, 24 Oct 2013 16:16:30 -0400 Received: by mail-ob0-f172.google.com with SMTP id gq1so27987obb.31 for ; Thu, 24 Oct 2013 13:16:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=oci03EuXh3bZF+7kcG43MGuVrl7H2QMO+vl5Z0sIpNk=; b=R2jLuNOHAQKycjc9B3XkdzVlA5lhIFBvo9ss+56r7H4utyo6PaLNhYY99wuXJt9Jbm 98zjJjUeNkycPoBe1S2SNcs0v424/GBLXudqcahHaf01Lixszc072KSpe5MMqxEHjMRi TllnKnNehrTRUJEt8KCMV3y0qIP/OHb+wEaeNTpNrONkxLRDS5o2I5WaOl0lYm6WhmFZ 84loRXBaQS2TbHwvdwKkWVeetd9pdeN90cw5eGpfgHFhOzoMjwEiDujUcVesZwQjsR49 AgEUdC8zjkr4Mco4YN4OyjQ1LtI9eJZelJ19DA4PBJCyGj+3ruvLlsTtTlu0jjd8OBQM hKEw== MIME-Version: 1.0 X-Received: by 10.60.144.230 with SMTP id sp6mr7581oeb.102.1382645787820; Thu, 24 Oct 2013 13:16:27 -0700 (PDT) Received: by 10.182.54.112 with HTTP; Thu, 24 Oct 2013 13:16:27 -0700 (PDT) In-Reply-To: <52697BAF.7020709@sugarcrm.com> References: <52697BAF.7020709@sugarcrm.com> Date: Thu, 24 Oct 2013 22:16:27 +0200 Message-ID: To: Stas Malyshev Cc: PHP internals Content-Type: multipart/alternative; boundary=047d7b5d5c14088a6e04e9824f40 Subject: Re: [PHP-DEV] [RFC] Exceptions in the engine From: nikita.ppv@gmail.com (Nikita Popov) --047d7b5d5c14088a6e04e9824f40 Content-Type: text/plain; charset=ISO-8859-1 On Thu, Oct 24, 2013 at 9:57 PM, Stas Malyshev wrote: > Hi! > > Looking at the patch, it converts zend_error_noreturn into > ZEND_IMPOSSIBLE, which is nothing in non-debug mode. This means code > that expected that execution ceases it this point (and jumps to a safe > bail-out point) now just continues in non-debug mode (probably causing > crash or memory corruption) or exits the process on failed assert in > debug mode. I'm not sure it is a good idea to do this. To make sure that there are no misunderstandings, Stas is referring to two particular occurrences where E_ERROR has been replaced with a ZEND_IMPOSSIBLE macro. Both occurrences are unreachable code (or so I judged), so they are effectively assertions implemented using E_ERROR rather than assert(). The ZEND_IMPOSSIBLE macro is a more explicit way of saying assert(0). PHP removes assertions in non-debug builds (optimization), so this follows suit. I did not mention this in the RFC because I'm not yet sure this change is necessary and I might yet keep them as (pointless) fatal errors instead, just in case. This is mainly a note to myself that I looked at the error and decided that it does not require conversion. > A lot of code assumes execution does not proceed past E_ERROR, but exceptions do not work that way. > That's correct. In the places where I replaced fatal errors with exceptions I make sure to free resources and handle the exception. Nikita --047d7b5d5c14088a6e04e9824f40--