Backtrace:

\n\n"; foreach( $backtrace as $trace => $frame ) { // 2 is the file that actually died. We don't need to list the error handlers in the trace. if( $trace < 2 ) { continue; } $args = array(); if( $trace > 2 ) { // The call in the error handler is irrelevent anyway, so don't bother with the arg list if ( isset( $frame['args'] ) ) { foreach( $frame['args'] as $arg ) { if ( is_array( $arg ) && array_key_exists( 0, $arg ) && is_string( $arg[0] ) ) { $argument = htmlspecialchars( $arg[0] ); } elseif( is_string( $arg ) ) { $argument = htmlspecialchars( $arg ); } else { $argument = NULL; } $args[] = "'{$argument}'"; } } } $frame['class'] = (isset($frame['class'])) ? $frame['class'] : ''; $frame['type'] = (isset($frame['type'])) ? $frame['type'] : ''; $frame['file'] = (isset($frame['file'])) ? $frame['file'] : ''; $frame['line'] = (isset($frame['line'])) ? $frame['line'] : ''; $func = ""; $arg_list = implode(", ", $args); if( $trace == 2 ) { $func = "See above for details."; } else { $func = htmlspecialchars($frame['class'] . $frame['type'] . $frame['function']) . '(' . $arg_list . ')'; } $out .= 'File: ' . $frame['file'] . "
\n"; $out .= 'Line: ' . $frame['line'] . "
\n"; $out .= 'Call: ' . $func . "

\n\n"; } return $out; } function error_fatal($type, $message, $file, $line = 0) { global $set; switch($type) { case E_USER_ERROR: $type_str = 'Error'; break; case E_WARNING: case E_USER_WARNING: $type_str = 'Warning'; break; case E_NOTICE: case E_USER_NOTICE: $type_str = 'Notice'; break; case PDNSADMIN_QUERY_ERROR: $type_str = 'Query Error'; break; default: $type_str = 'Unknown Error'; } if (strstr($file, 'eval()')) { $split = preg_split('/[\(\)]/', $file); $file = $split[0]; $line = $split[1]; $message .= ' (in evaluated code)'; } $details = null; $backtrace = null; if (strpos($message, 'Template not found') === false) { $backtrace = get_backtrace(); } if ($type != PDNSADMIN_QUERY_ERROR) { if (strpos($message, 'mysql_fetch_array(): supplied argument') === false) { $lines = null; $details2 = null; if (strpos($message, 'Template not found') !== false) { $backtrace = ''; $trace = debug_backtrace(); $file = $trace[2]['file']; $line = $trace[2]['line']; } if (file_exists($file)) { $lines = file($file); } if ($lines) { $details2 = " Code:
\n " . error_getlines($lines, $line) . ''; } } else { $details2 = " MySQL Said:
" . mysql_error() . '
\n'; } $details .= " $type_str [$type]:
\n The error was reported on line $line of $file

\n\n$details2"; } else { $details .= " $type_str [$line]:
\n This type of error is reported by MySQL.

Query:
$file
\n"; } $checkbug = error_report($type, $message, $file, $line); // IIS does not use $_SERVER['QUERY_STRING'] in the same way as Apache and might not set it if (isset($_SERVER['QUERY_STRING'])) { $temp_querystring = str_replace("&","&", $_SERVER['QUERY_STRING']); } else { $temp_querystring = ''; } // DO NOT allow this information into the error reports!!! $details = str_replace( $set['db_name'], "****", $details ); $details = str_replace( $set['db_pass'], "****", $details ); $details = str_replace( $set['db_user'], "****", $details ); $details = str_replace( $set['db_host'], "****", $details ); $backtrace = str_replace( $set['db_name'], "****", $backtrace ); $backtrace = str_replace( $set['db_pass'], "****", $backtrace ); $backtrace = str_replace( $set['db_user'], "****", $backtrace ); $backtrace = str_replace( $set['db_host'], "****", $backtrace ); // Don't send it if this isn't available. Spamming mail servers is a bad bad thing. // This will also email the user agent string, in case errors are being generated by evil bots. if( isset($set['admin_email']) ) { $mailer = new mailer($set['admin_email'], $set['admin_email'], 'PDNS-Admin Error Module', false); $mailer->setSubject('PDNS-Admin Error Report'); $agent = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : 'N/A'; $ip = isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : '127.0.0.1'; $error_report = "PDNS-Admin has exited with an error!\n"; $error_report .= "The error details are as follows:\n\nURL: http://" . $_SERVER['SERVER_NAME'] . $_SERVER['PHP_SELF'] . "?" . $_SERVER['QUERY_STRING'] . "\n"; $error_report .= "Querying user agent: " . $agent . "\n"; $error_report .= "Querying IP: " . $ip . "\n\n"; $error_report .= strip_tags($message) . "\n\n" . strip_tags($details) . "\n\n" . strip_tags($backtrace); $error_report = str_replace( ' ', ' ', html_entity_decode($error_report) ); $mailer->setMessage($error_report); $mailer->setRecipient($set['admin_email']); $mailer->doSend(); } return " PDNS-Admin Error PDNS-Admin has exited with an error!


$message

$details


$backtrace


View debug information (advanced)
Return to the console "; } function error_getlines($lines, $line) { $code = null; $padding = ' '; $previ = $line-3; $total_lines = count($lines); for ($i = $line - 3; $i <= $line + 3; $i++) { if ((strlen($previ) < strlen($i)) && ($padding == ' ')) { $padding = null; } if (($i < 1) || ($i > $total_lines)) { continue; } $codeline = rtrim(htmlentities($lines[$i-1])); $codeline = str_replace("\t", '    ', $codeline); $codeline = str_replace(' ', ' ', $codeline); if ($i != $line) { $code .= $i . $padding . $codeline . "
\n"; } else { $code .= '' . $i . $padding . $codeline . "
\n"; } $previ = $i; } return $code; } function error_report($type, $message, $file, $line) { global $error_version; if (stristr($message, 'mysql_fetch_array(): supplied argument is not a valid MySQL result resource')) { $message .= '; ' . mysql_error(); } if (!isset($GLOBALS['pdnsadmin']) && class_exists('pdnsadmin')) { $pdns = new pdnsadmin; } elseif (isset($GLOBALS['pdnsadmin'])) { $pdns = $GLOBALS['pdnsadmin']; } $mysql_version = mysql_result(mysql_query('SELECT VERSION() as version'), 0, 0); $server_software = isset($_SERVER['SERVER_SOFTWARE']) ? $_SERVER['SERVER_SOFTWARE'] : 0; $safe_mode = get_cfg_var('safe_mode') ? 1 : 0; // $str = serialize(array($error_version, $pdns->version, PHP_VERSION, $mysql_version,$message, $server_software, PHP_OS, $safe_mode, $line)); $str = ''; return urlencode(base64_encode(md5($str) . $str)); } function error_warning($message, $file, $line) { return $message; } function error_notice($message) { return $message; } ?>