Bug #66425 [Opn->Nab]: Misleading fatal error with nested exceptions
Edit report at https://bugs.php.net/bug.php?id=66425&edit=1
ID: 66425
Updated by: cmb@php.net
Reported by: r dot wilczek at web-appz dot de
Summary: Misleading fatal error with nested exceptions
-Status: Open
+Status: Not a bug
Type: Bug
Package: *General Issues
Operating System: Linux
PHP Version: 5.5.7
-Assigned To:
+Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
> In the test script below, Foo was actually caught and nested in
> an uncaught Bar.
No, not really. The Foo instance has been passed as $previous
argument to the Bar constructor, so the first exception is a Foo,
and the next exception is a Bar. And the stacktrace displays the
exceptions in that order.
Previous Comments:
------------------------------------------------------------------------
[2014-01-06 11:24:24] r dot wilczek at web-appz dot de
Description:
------------
Exceptions nesting a previous exception result in misleading error-reports.
In the test script below, Foo was actually caught and nested in an uncaught Bar.
The resulting fatal error errorneously suggests, that Foo was not caught.
Test script:
---------------
class Foo extends \Exception {};
class Bar extends \Exception {};
try {
throw new Foo('Foo-message');
} catch (Foo $e) {
throw new Bar('Bar-message', 4711, $e);
}
Expected result:
----------------
Fatal error: Uncaught exception 'Bar' with message 'Bar-message' in test.php on
line 8
Foo: Foo-message in test.php on line 6
Call Stack:
0.0002 269440 1. {main}() test.php:0
Bar: Bar-message in test.php on line 8
Call Stack:
0.0002 269440 1. {main}() test.php:0
Actual result:
--------------
Fatal error: Uncaught exception 'Foo' with message 'Foo-message' in test.php on
line 8
Foo: Foo-message in test.php on line 6
Call Stack:
0.0002 269440 1. {main}() test.php:0
Bar: Bar-message in test.php on line 8
Call Stack:
0.0002 269440 1. {main}() test.php:0
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=66425&edit=1
Thread (2 messages)