php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #66425 Misleading fatal error with nested exceptions
Submitted: 2014-01-06 11:24 UTC Modified: -
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: r dot wilczek at web-appz dot de Assigned:
Status: Open Package: *General Issues
PHP Version: 5.5.7 OS: Linux
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2014-01-06 11:24 UTC] 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

Patches

Add a Patch

Pull Requests

Add a Pull Request

 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Mon Aug 19 18:01:27 2019 UTC