Re: Exception message cleanup

From: Date: Thu, 09 Apr 2015 23:32:24 +0000
Subject: Re: Exception message cleanup
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-85762@lists.php.net to get a copy of this message
On Thu, Apr 9, 2015 at 11:04 AM, Nikita Popov <nikita.ppv@gmail.com> 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. Thanks. Dmitry. > > Thanks, > Nikita >

« previous php.internals (#85762) next »