On Thu, Apr 9, 2015 at 10:04 AM, Nikita Popov <nikita....@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. > An update on this: EngineException and TypeException now display as normal exceptions (including stack trace). ParseException still show as a "Parse error". I don't plan to change that one. Instead of the relatively aggressive message changes described above I've only landed a small tweak (see https://github.com/php/php-src/commit/3ae995f03c8f60c4a4c9718262545cf5a6a08da3), which fixes the problem with nested quotes but keeps current structure. Nikita