#47284 [Opn->Fbk]: Args disappear from exception stack trace (works in 5.3)
ID: 47284
Updated by: jani@php.net
Reported By: thekid@php.net
-Status: Open
+Status: Feedback
Bug Type: Scripting Engine problem
Operating System: *
PHP Version: 5.2.8
New Comment:
Please try using this CVS snapshot:
http://snaps.php.net/php5.2-latest.tar.gz
For Windows:
http://windows.php.net/snapshots/
Previous Comments:
------------------------------------------------------------------------
[2009-02-02 22:38:33] thekid@php.net
Description:
------------
Exception's stacktraces miss the "args" key in certain situations
(whereas debug_backtrace() will report them).
Reproduce code:
---------------
php -r 'class Chained extends Exception { function
__construct($message, $cause) { parent::__construct($message);
$this->cause= $cause; }} function raise($message, $cause) { throw new
Chained($message, new Exception($cause)); } try { raise("Arg", "Cause");
} catch (Exception $e) { var_dump($e->getTrace(),
$e->cause->getTrace()); }'
Expected result:
----------------
Twice this:
array(1) {
[0]=>
array(4) {
["file"]=>
string(17) "Command line code"
["line"]=>
int(1)
["function"]=>
string(5) "raise"
["args"]=>
array(2) {
[0]=>
&string(3) "Arg"
[1]=>
&string(5) "Cause"
}
}
}
Actual result:
--------------
array(1) {
[0]=>
array(4) {
["file"]=>
string(17) "Command line code"
["line"]=>
int(1)
["function"]=>
string(5) "raise"
["args"]=>
array(2) {
[0]=>
string(3) "Arg"
[1]=>
string(5) "Cause"
}
}
}
array(1) {
[0]=>
array(3) {
["file"]=>
string(17) "Command line code"
["line"]=>
int(1)
["function"]=>
string(5) "raise"
}
}
The second array is missing the "args" key. In PHP 5.3, it's present.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=47284&edit=1
Thread (7 messages)