note 99690 rejected from exception.gettrace by danbrown

From: Date: Tue, 31 Aug 2010 14:58:21 +0000
Subject: note 99690 rejected from exception.gettrace by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-172203@lists.php.net to get a copy of this message
Note Submitter: sskaje at gmail dot com ---- Exceptions thown in a function/method been called via 'call_user_func' or 'call_user_func_array', have key 'file' and 'line' disappeared in their first element (array[0]) from Exception::getTrace(). <?php function test() { debug_print_backtrace(); throw new Exception('1'); } try { test(); } catch (Exception $e) { var_dump($e->getTrace()); } function callback() { call_user_func('test'); } try { callback(); } catch (Exception $e) { var_dump($e->getTrace()); } ?> G:\wwwroot\Test\Exception>php trace_func.php #0 test() called at [G:\wwwroot\Test\Exception\trace_func.php:8] array(1) { [0]=> array(4) { ["file"]=> string(40) "G:\wwwroot\Test\Exception\trace_func.php" ["line"]=> int(8) ["function"]=> string(4) "test" ["args"]=> array(0) { } } } #0 test() #1 call_user_func(test) called at [G:\wwwroot\Test\Exception\trace_func.php:14] #2 callback() called at [G:\wwwroot\Test\Exception\trace_func.php:18] array(3) { [0]=> array(2) { ["function"]=> string(4) "test" ["args"]=> array(0) { } } [1]=> array(4) { ["file"]=> string(40) "G:\wwwroot\Test\Exception\trace_func.php" ["line"]=> int(14) ["function"]=> string(14) "call_user_func" ["args"]=> array(1) { [0]=> string(4) "test" } } [2]=> array(4) { ["file"]=> string(40) "G:\wwwroot\Test\Exception\trace_func.php" ["line"]=> int(18) ["function"]=> string(8) "callback" ["args"]=> array(0) { } } } Similar result given by debug_print_backtrace(), is this a bug or an unexpected feature ? XD

« previous php.notes (#172203) next »