note 65433 deleted from function.debug-backtrace by cmb

From: Date: Sun, 17 Nov 2019 08:31:36 +0000
Subject: note 65433 deleted from function.debug-backtrace by cmb
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-213066@lists.php.net to get a copy of this message
Note Submitter: tiwen at rpgame dot de ---- 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!"); ?>

« previous php.notes (#213066) next »