#33407 [Opn->Bgs]: Invalid exception stack traces
| From: | sfox@php.net | Date: | Tue, 21 Jun 2005 13:54:12 +0000 |
| Subject: | #33407 [Opn->Bgs]: Invalid exception stack traces | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-80767@lists.php.net to get a copy of this message | ||
ID: 33407
Updated by: sfox@php.net
Reported By: tomas_matousek at hotmail dot com
-Status: Open
+Status: Bogus
Bug Type: Zend Engine 2 problem
Operating System: WinXP
PHP Version: 5.0.4
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
This is expected behaviour, as Jani said. I'm therefore marking this
report bogus.
Previous Comments:
------------------------------------------------------------------------
[2005-06-21 08:53:54] tomas_matousek at hotmail dot com
Well, that's the point of all of that! I don't want to catch it because
I want the stack trace to be shown. Alternatively, I can add try { }
catch(Exception $f) { echo $f; } and the effect would be the same - a
wrong stack trace would be printed. This has nothing to do with leaving
exception uncaught.
------------------------------------------------------------------------
[2005-06-20 22:42:27] sniper@php.net
You throw in the last catch block but never catch that.
------------------------------------------------------------------------
[2005-06-20 20:55:50] tomas_matousek at hotmail dot com
I don't understand your comment. If you comment out the "throw $a;"
statement the exception is not thrown. So the "new" expression doesn't
throw it. However, if the exception is thrown by throw $a; why the
stack trace is generated during the construction. That's definitely a
bug.
------------------------------------------------------------------------
[2005-06-20 16:06:02] sniper@php.net
Don't keep on throwing it..it never get's there -> no bug
------------------------------------------------------------------------
[2005-06-20 15:38:11] tomas_matousek at hotmail dot com
Description:
------------
Exception stack trace is created by the new operator and not when the
exception is thrown. Is that an intention or a bug? I think it is bug
and that it was intended to trace throwing of the exception since the
stack trace message contains
"thrown in ..."
and not
"created in ...".
Reproduce code:
---------------
<?
function f()
{
return new Exception("hello");
}
try
{
$a = f();
throw $a;
}
catch(Exception $e)
{
throw $e;
}
Expected result:
----------------
Fatal error: Uncaught exception 'Exception' with message 'hello' in
C:\Web\$PhpTests\z.php:14
Stack trace:
#0 C:\Web\$PhpTests\z.php(14):
#1 {main}
thrown in C:\Web\$PhpTests\z.php on line 14
Actual result:
--------------
Fatal error: Uncaught exception 'Exception' with message 'hello' in
C:\Web\$PhpTests\z.php:4
Stack trace:
#0 C:\Web\$PhpTests\z.php(4): f()
#1 C:\Web\$PhpTests\z.php(9): f()
#2 {main}
thrown in C:\Web\$PhpTests\z.php on line 4
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=33407&edit=1