#45767 [Opn->Fbk]: Uncommon order and chained exceptions
| From: | johannes@php.net | Date: | Sat, 09 Aug 2008 20:45:17 +0000 |
| Subject: | #45767 [Opn->Fbk]: Uncommon order and chained exceptions | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-127834@lists.php.net to get a copy of this message | ||
ID: 45767
Updated by: johannes@php.net
Reported By: david at grudl dot com
-Status: Open
+Status: Feedback
Bug Type: Scripting Engine problem
Operating System: *
PHP Version: 5.3.0alpha1
New Comment:
Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves.
A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external
resources such as databases, etc. If the script requires a
database to demonstrate the issue, please make sure it creates
all necessary tables, stored procedures etc.
Please avoid embedding huge scripts into the report.
Your code handles an exception, throws a new one, which results in an
"Fatal error: Uncaught exception", neither what you expect nor your
actual code, please provide a proper reproduce case and explain the
issue.
Previous Comments:
------------------------------------------------------------------------
[2008-08-08 17:15:27] david at grudl dot com
Sorry - Expected result is Actual and Actual is Expected.
------------------------------------------------------------------------
[2008-08-08 17:13:33] david at grudl dot com
Description:
------------
Chained exceptions are printed in uncommon order (from inner to outer
exception). This makes me confused :-(
Reference:
http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Throwable.html#printStackTrace()
Reproduce code:
---------------
try {
throw new FileNotFoundException("File not found.");
} catch (FileNotFoundException $e) {
throw new ConfigException("Missing configuration.", 0, $e);
}
echo $e; // note $e is ConfigException!
Expected result:
----------------
exception 'FileNotFoundException' with message 'File not found.' in
demo.php:8
Stack trace:
#0 demo.php(17): ...
#1 {main}
Next exception 'ConfigException' with message 'Missing configuration.'
in demo.php:21
Stack trace:
#0 demo.php(28): ....
#1 {main}
Actual result:
--------------
exception 'ConfigException' with message 'Missing configuration.' in
demo.php:21
Stack trace:
#0 demo.php(28): ....
#1 {main}
previous exception 'FileNotFoundException' with message 'File not
found.' in demo.php:8
Stack trace:
#0 demo.php(17): ...
#1 {main}
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=45767&edit=1