note 65433 added to function.debug-backtrace

From: Date: Sun, 30 Apr 2006 20:25:45 +0000
Subject: note 65433 added to function.debug-backtrace
Groups: php.notes 
Request: Send a blank email to php-notes+get-110209@lists.php.net to get a copy of this message
Another debug output. This is a short function that does not display the args (sometimes password are in arguments ...) and shows the callstack clearly in a table. In most cases i don't need more ... <?php function dieDebug($sError) { echo "<hr /><div>".$sError."<br /><table border='1'>"; $sOut=""; $aCallstack=debug_backtrace(); echo "<thead><tr><th>file</th><th>line</th><th>function</th>". "</tr></thead>"; foreach($aCallstack as $aCall) { if (!isset($aCall['file'])) $aCall['file'] = '[PHP Kernel]'; if (!isset($aCall['line'])) $aCall['line'] = ''; echo "<tr><td>{$aCall["file"]}</td><td>{$aCall["line"]}</td>". "<td>{$aCall["function"]}</td></tr>"; } echo "</table></div><hr /></p>"; die(); } ?> To use it, simply do something like this: <?php if(...) dieDebug("another error found!"); ?> ---- Server IP: 217.13.201.10 Probable Submitter: 87.123.161.93 ---- X-Spam-Status: No, hits=4.0 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER, HTML_20_30,HTML_MESSAGE autolearn=no version=2.64 ---- Manual Page -- http://www.php.net/manual/en/function.debug-backtrace.php Edit -- http://master.php.net/note/edit/65433 Del: integrated -- http://master.php.net/note/delete/65433/integrated Del: useless -- http://master.php.net/note/delete/65433/useless Del: bad code -- http://master.php.net/note/delete/65433/bad+code Del: spam -- http://master.php.net/note/delete/65433/spam Del: non-english -- http://master.php.net/note/delete/65433/non-english Del: in docs -- http://master.php.net/note/delete/65433/in+docs Del: other reasons-- http://master.php.net/note/delete/65433 Reject -- http://master.php.net/note/reject/65433 Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#110209) next »