note 110706 added to exception.gettrace

From: Date: Sun, 25 Nov 2012 23:06:14 +0000
Subject: note 110706 added to exception.gettrace
Groups: php.notes 
Request: Send a blank email to php-notes+get-192143@lists.php.net to get a copy of this message
This method returns array that is very similar to that returned by debug_backtrace(). One difference is the one mentioned by sam at notmyrealemail dot org on 17-Feb-2012 04:26 "1) The trace does not include the file / line at which the exception is thrown; that entry is only recorded in the top-level getFile/Line methods." So if you want to make it more similar to debug_backtrace() you could do something like this: <?php $trace = $exception->getTrace(); array_unshift($trace, array('file' => $exception->getFile(), 'line' => $exception->getLine())); ?> The first element of $trace will have file & line of place where the exception was thrown. ie. you could then pass it to some common loging mechanism, that accepts both exceptions' trace and debug_backtrace() output as a parameter. ---- Server IP: 46.17.113.3 Probable Submitter: 213.25.47.210 ---- Manual Page -- http://www.php.net/manual/en/exception.gettrace.php Edit -- https://master.php.net/note/edit/110706 Del: integrated -- https://master.php.net/note/delete/110706/integrated Del: useless -- https://master.php.net/note/delete/110706/useless Del: bad code -- https://master.php.net/note/delete/110706/bad+code Del: spam -- https://master.php.net/note/delete/110706/spam Del: non-english -- https://master.php.net/note/delete/110706/non-english Del: in docs -- https://master.php.net/note/delete/110706/in+docs Del: other reasons-- https://master.php.net/note/delete/110706 Reject -- https://master.php.net/note/reject/110706 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#192143) next »