note 85564 added to function.debug-print-backtrace
| From: | RajeevJha at osu1 dot php dot net | Date: | Sat, 06 Sep 2008 10:54:37 +0000 |
| Subject: | note 85564 added to function.debug-print-backtrace | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-144184@lists.php.net to get a copy of this message | ||
You can use debug_print_backtrace in your error templates. This can be a good debugging aid. Inside
your error template
<?php
//clean out the script output
ob_end_clean();
//start buffering
ob_start();
$stackTrace = '' ;
if(intval(T_Config::getInstance()>get_stack_trace()) == 1 ) {
debug_print_backtrace();
//get output buffer contents
$stackTrace = ob_get_contents();
}
ob_end_clean();
//send raw error to our log file
$errorstr = $stackTrace;
error_log ("$file:$line : $errorstr \n",3,$logFile);
// translate the raw error for template
$bindings['ERROR_MESSAGE'] = some_encrypt_fn($errorstr) ;
//output error template
//start buffering again
ob_start();
?>
so when an error happens your site users will see some encrypted form of stack trace that can be
mailed back to you.
----
Server IP: 202.136.100.225
Probable Submitter: 122.167.42.223
----
Manual Page -- http://www.php.net/manual/en/function.debug-print-backtrace.php
Edit -- https://master.php.net/note/edit/85564
Del: integrated -- https://master.php.net/note/delete/85564/integrated
Del: useless -- https://master.php.net/note/delete/85564/useless
Del: bad code -- https://master.php.net/note/delete/85564/bad+code
Del: spam -- https://master.php.net/note/delete/85564/spam
Del: non-english -- https://master.php.net/note/delete/85564/non-english
Del: in docs -- https://master.php.net/note/delete/85564/in+docs
Del: other reasons-- https://master.php.net/note/delete/85564
Reject -- https://master.php.net/note/reject/85564
Search -- https://master.php.net/manage/user-notes.php