Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:85766 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 22269 invoked from network); 10 Apr 2015 10:11:43 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 10 Apr 2015 10:11:43 -0000 Authentication-Results: pb1.pair.com smtp.mail=nikita.ppv@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=nikita.ppv@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.212.179 as permitted sender) X-PHP-List-Original-Sender: nikita.ppv@gmail.com X-Host-Fingerprint: 209.85.212.179 mail-wi0-f179.google.com Received: from [209.85.212.179] ([209.85.212.179:35329] helo=mail-wi0-f179.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 9F/30-19300-FD1A7255 for ; Fri, 10 Apr 2015 06:11:43 -0400 Received: by widdi4 with SMTP id di4so122521026wid.0 for ; Fri, 10 Apr 2015 03:11:40 -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=3eLbN6SXgtHF+yKUQUdf+BwbpeZ1hxE66AoQoXHuO7Q=; b=t5o9tn0GI5GtL0ATiw5Os0ERDWisrednnFNPlIbf78TWmtnD7Wrgl8Afvh6mXrFoFL lBZKyRdoaEba4zUR2AxDlZozDwlVAnAk7/37ts7eILIUhBm/keZ18KYaoP9gVlmYv+jc 3YWnpuSGHRfFHTIuii9RF+QwmyNA2HWBrr7sr41zXbmLy3c0xhoQps/Y3aEzO1hLetFV P5NFJD4XLusXQzuyubICwJFWuCWzZWUWPKebmGo6hZX3lm4hfGVXvHRS9Bwx5yLDEZTK E6yq56VScrzeGWlbZNsxfg2I/kpqwTumUaFFSL68S07qFCZahfy5oIPO7eOXNzx3mQ/x XhNg== MIME-Version: 1.0 X-Received: by 10.194.76.69 with SMTP id i5mr1661842wjw.3.1428660700423; Fri, 10 Apr 2015 03:11:40 -0700 (PDT) Received: by 10.27.86.133 with HTTP; Fri, 10 Apr 2015 03:11:40 -0700 (PDT) In-Reply-To: References: Date: Fri, 10 Apr 2015 12:11:40 +0200 Message-ID: To: Dmitry Stogov Cc: PHP internals Content-Type: multipart/alternative; boundary=047d7bb042be8dae2d05135bfd51 Subject: Re: [PHP-DEV] Exception message cleanup From: nikita.ppv@gmail.com (Nikita Popov) --047d7bb042be8dae2d05135bfd51 Content-Type: text/plain; charset=UTF-8 On Fri, Apr 10, 2015 at 1:32 AM, Dmitry Stogov wrote: > > > On Thu, Apr 9, 2015 at 11:04 AM, Nikita Popov > wrote: > >> Hi internals! >> >> A lot of people have been confused about engine exceptions currently >> displaying as normal fatal errors (if they aren't caught). We'll have to >> change this to use exception messages. >> >> Before doing this I'd like to clean up the messages a bit to make them >> more >> friendly for CLI usage. Currently the messages are so cluttered that it's >> hard to find the actual error message if you're in an 80 char window. >> >> Patch is here: https://github.com/php/php-src/pull/1226 >> >> Previous message: >> >> Fatal error: Uncaught exception 'UnexpectedValueException' with message >> 'Failed to open directory ""' in %s:%d >> Stack trace: >> #0 %s(%d): DirectoryIterator->__construct('\x00/abc') >> #1 {main} >> thrown in %s on line %d >> >> New message: >> >> UnexpectedValueException: Failed to open directory "" in %s on line %d >> Stack trace: >> #0 %s(%d): DirectoryIterator->__construct('\x00/abc') >> #1 {main} >> >> Essentially exceptions would display like ordinary error, but with "Fatal >> error" / "Warning" / ... replaced by the exception name, and showing a >> stack trace after the error. >> >> A side-effect of the change is that uncaught exceptions will always be >> displayed canonically and not based on __toString output. To modify >> display >> of exception output, people should modify the respective properties of the >> exception. >> >> Any objections to this? >> > > We will have to change half of PHPT tests. > New tests with fatal errors are going to be incompatible between PHP-5 and > PHP-7. > Log analysers written for PHP-5 won't work with PHP-7. > I've been getting a lot of "bug reports" about how this behavior and that behavior is giving them a "Fatal error" in PHP 7, even though it's supposed to be an exception. I don't think it's viable to leave the engine exception messages as they are now. Especially as some fatals really are fatals and not exceptions and it's currently impossible to distinguish which are which based on the message (and it's also not visible what kind of exception was thrown, e.g. whether it was a TypeException). Nikita --047d7bb042be8dae2d05135bfd51--