[Openfirst-cvscommit] base/includes/functions debug.php,1.6,1.7
Brought to you by:
xtimg
From: Jamie <ast...@us...> - 2006-02-23 17:14:39
|
Update of /cvsroot/openfirst/base/includes/functions In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15257/includes/functions Modified Files: debug.php Log Message: Updated variable names Now taking the MD5 hash of the file that threw the error, not the file that handled the request. Index: debug.php =================================================================== RCS file: /cvsroot/openfirst/base/includes/functions/debug.php,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** debug.php 22 Aug 2005 17:36:57 -0000 1.6 --- debug.php 23 Feb 2006 17:14:34 -0000 1.7 *************** *** 1,139 **** ! <?php ! /* ! * openFIRST.base - config/functions/debug.php ! * ! * Copyright (C) 2003, ! * openFIRST Project ! * Original Author: Tim Ginn <tim...@po...> ! * ! * This program is free software; you can redistribute it and/or modify ! * it under the terms of the GNU General Public License as published by ! * the Free Software Foundation; either version 2 of the License, or ! * (at your option) any later version. ! * ! * This program is distributed in the hope that it will be useful, ! * but WITHOUT ANY WARRANTY; without even the implied warranty of ! * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! * GNU General Public License for more details. ! * This program is distributed in the hope that it will be useful, ! * but WITHOUT ANY WARRANTY; without even the implied warranty of ! * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! * GNU General Public License for more details. ! * ! * You should have received a copy of the GNU General Public License ! * along with this program; if not, write to the Free Software ! * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ! * ! */ ! // Purpose: Provide some useful features for debugging certain problems. ! // This entire process is optional, of course. Anyone may easily ! // simply remove this file in order to eliminate the debugging. ! ! set_error_handler("ofirst_error_handler"); ! if (!isset($NO_ADD_BUG)) $NO_ADD_BUG = false; ! ! // Handles errors by displaying a message and contacting openFIRST ! // developers for assistance. ! function ofirst_error_handler($errno,$error,$file,$line,$context) { ! global $DBaseType, $Encryption, $Title, $Version, $sqlServer, $sqlUser, $sqlPassword, $sqlDatabase, ! $sqlConnection, $PassSaveDisabled, $regEnabled, $Server, $BasePath, $fBasePath, $Home, ! $StylePath, $fStylePath, $Header, $Footer, $MailNotify, $MailFrom, $ogDB; ! global $osType, $currentmodule, $user, $lastquery, $usingPHP5; ! global $NO_ADD_BUG; ! $dberrno = $ogDB->errorNumber(); ! $dberror = $ogDB->errorString(); ! ! if(! function_exists("md5_file")) { ! $checksum = "na"; ! } else { ! if (isset($_SERVER['SCRIPT_FILENAME'])) { ! $checksum = md5_file($_SERVER['SCRIPT_FILENAME']); ! } ! } ! ! if ($usingPHP5 && $errno == 2048) return; ! ! $details = "MD5: $checksum ! Database Type: $DBaseType ! Operating System: $osType ! SQL Server: $sqlServer ! Current Module: $currentmodule ! Error Number: $errno"; ! ! $specifics = "PHP_SELF: {$_SERVER['PHP_SELF']}"; ! if (isset($_SERVER['HTTP_HOST'])) ! $specifics .= " ! HTTP Host: {$_SERVER['HTTP_HOST']}"; ! ! if (isset($_SERVER['HTTP_REFERER'])) { ! $specifics .= " ! HTTP Referer: {$_SERVER['HTTP_REFERER']}"; ! } ! $specifics .= " ! Translated Path: {$_SERVER['SCRIPT_FILENAME']}"; ! if (isset($user) ) { ! $specifics .= " ! User: {$user->user} ! User Access Level: {$user->membertype}"; ! } ! $specifics .= " ! Error Description: {$error} in {$file} on line {$line}"; ! if ($dberrno != 0) { ! $specifics .= " ! DB Error Number: {$dberrno} ! DB Error: {$dberror} ! Last Query: {$lastquery}"; ! } ! ! if ($NO_ADD_BUG) ! { ! echo "<br /><div class=\"error\"><h2>Error:</h2><dl>"; ! echo "<dt>Details:</dt><dd><pre>"; ! echo $details; ! echo "</pre></dd>\n"; ! echo "<dt>Specifics:</dt><dd><pre>"; ! echo $specifics; ! echo "</pre></dd>\n"; ! echo "<dt>Backtrace:</dt><dd><pre>"; ! debug_print_backtrace(); ! echo "</pre></dd>\n"; ! echo "</dl>"; ! echo "</div>"; ! } else { ! // Notify the appropriate local contact ! mail($mailnotify, "$error in $file on line $line", "Error Description: $error in $file on line $line ! ! There is additional information regarding this bug stored on ! the openFIRST Bugzilla Server at: ! ! http://bugzilla.openfirst.org/", "From: $mailfrom"); ! ! // Attempt to contact the openFIRST Bugzilla Server ! $bugzilla = fopen( "http://bugzilla.openfirst.org/openfirst/". ! "?module=$currentmodule". ! "&uri=" . urlencode($_SERVER["HTTP_HOST"] . $_SERVER["SCRIPT_NAME"]). ! "&details=".urlencode($details). ! "&specifics=".urlencode($specifics) . ! ($NO_ADD_BUG ? "&no-commit=true" : ""), "r"); ! ! if(! $bugzilla) { ! // If a connection cannot be established to the Bugzilla server ! echo("Could not contact the openFIRST Bugzilla server."); ! echo("<h3><strong>$errno</strong> - <strong>$error</strong> in ! <strong>$file</strong> on line <strong>$line</strong></h3> ! <p><strong>The openFIRST system has encountered an error. This ! may be due to a misconfiguration on the behalf of the person installing it, ! or an error in the openFIRST code.</strong></p> ! <p>Debugging may be disabled by removing (config/functions/debug.php)"); ! ! } else { ! // If a connection is established to the Bugzilla server then rely ! // completely on it for the appropriate error message to show. ! while(!feof($bugzilla)) { ! $line = fgets($bugzilla, 2048); ! echo $line; ! } ! } ! } ! } ! ?> --- 1,136 ---- ! <?php ! /* openFIRST.base - config/functions/debug.php ! * ! * Copyright (C) 2003, ! * openFIRST Project ! * Original Author: Tim Ginn <tim...@po...> ! * ! * This program is free software; you can redistribute it and/or modify ! * it under the terms of the GNU General Public License as published by ! * the Free Software Foundation; either version 2 of the License, or ! * (at your option) any later version. ! * ! * This program is distributed in the hope that it will be useful, ! * but WITHOUT ANY WARRANTY; without even the implied warranty of ! * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! * GNU General Public License for more details. ! * This program is distributed in the hope that it will be useful, ! * but WITHOUT ANY WARRANTY; without even the implied warranty of ! * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! * GNU General Public License for more details. ! * ! * You should have received a copy of the GNU General Public License ! * along with this program; if not, write to the Free Software ! * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ! * ! */ ! // Purpose: Provide some useful features for debugging certain problems. ! // This entire process is optional, of course. Anyone may easily ! // simply remove this file in order to eliminate the debugging. ! ! set_error_handler("ofirst_error_handler"); ! if (!isset ($NO_ADD_BUG)) ! $NO_ADD_BUG = false; ! ! // Handles errors by displaying a message and contacting openFIRST ! // developers for assistance. ! function ofirst_error_handler($errno, $error, $file, $line, $context) { ! global $ogDataBaseType, $ogEncryptionType, $ogSiteTitle, $ogVersion, ! $ogSQLServer, $ogSQLUser, $ogSQLPassword, $ogSQLDatabase, ! $ogSQLConnection, $ogPasswordSaveEnabled, $regEnabled, $Server, ! $BasePath, $fBasePath, $Home, $StylePath, $fStylePath, $ogHeader, ! $ogFooter, $ogMailNotify, $ogMailFrom, $ogDB, $osType, ! $ogCurrentModule, $ogUser, $lastquery, $usingPHP5; ! global $NO_ADD_BUG; ! $dberrno = $ogDB->errorNumber(); ! $dberror = $ogDB->errorString(); ! ! if (!function_exists("md5_file")) { ! $checksum = "na"; ! } else { ! if (isset ($file)) { ! $checksum = md5_file($file); ! } ! } ! ! if ($usingPHP5 && $errno == 2048) ! return; // Don't handle E_STRICT ! ! $details = "MD5: $checksum ! Database Type: $ogDataBaseType ! Operating System: $osType ! SQL Server: $ogSQLServer ! Current Module: $ogCurrentModule ! Error Number: $errno"; ! ! $specifics = "PHP_SELF: {$_SERVER['PHP_SELF']}"; ! if (isset ($_SERVER['HTTP_HOST'])) ! $specifics .= " ! HTTP Host: {$_SERVER['HTTP_HOST']}"; ! ! if (isset ($_SERVER['HTTP_REFERER'])) { ! $specifics .= " ! HTTP Referer: {$_SERVER['HTTP_REFERER']}"; ! } ! $specifics .= " ! Translated Path: {$_SERVER['SCRIPT_FILENAME']}"; ! if (isset ($user)) { ! $specifics .= " ! User: {$user->user} ! User Access Level: {$user->membertype}"; ! } ! $specifics .= " ! Error Description: {$error} in {$file} on line {$line}"; ! if ($dberrno != 0) { ! $specifics .= " ! DB Error Number: {$dberrno} ! DB Error: {$dberror} ! Last Query: {$lastquery}"; ! } ! ! if ($NO_ADD_BUG) { ! echo "<br /><div class=\"error\"><h2>Error:</h2><dl>"; ! echo "<dt>Details:</dt><dd><pre>"; ! echo $details; ! echo "</pre></dd>\n"; ! echo "<dt>Specifics:</dt><dd><pre>"; ! echo $specifics; ! echo "</pre></dd>\n"; ! echo "<dt>Backtrace:</dt><dd><pre>"; ! debug_print_backtrace(); ! echo "</pre></dd>\n"; ! echo "</dl>"; ! echo "</div>"; ! } else { ! // Notify the appropriate local contact ! mail($ogMailNotify, "$error in $file on line $line", "Error Description: $error in $file on line $line ! ! There is additional information regarding this bug stored on ! the openFIRST Bugzilla Server at: ! ! http://bugzilla.openfirst.org/", "From: $mailfrom"); ! ! // Attempt to contact the openFIRST Bugzilla Server ! $bugzilla = fopen("http://bugzilla.openfirst.org/openfirst/"."?module=$currentmodule"."&uri=".urlencode($_SERVER["HTTP_HOST"].$_SERVER["SCRIPT_NAME"])."&details=".urlencode($details)."&specifics=".urlencode($specifics). ($NO_ADD_BUG ? "&no-commit=true" : ""), "r"); ! ! if (!$bugzilla) { ! // If a connection cannot be established to the Bugzilla server ! echo ("Could not contact the openFIRST Bugzilla server."); ! echo ("<h3><strong>$errno</strong> - <strong>$error</strong> in ! <strong>$file</strong> on line <strong>$line</strong></h3> ! <p><strong>The openFIRST system has encountered an error. This ! may be due to a misconfiguration on the behalf of the person installing it, ! or an error in the openFIRST code.</strong></p> ! <p>Debugging may be disabled by removing (config/functions/debug.php)"); ! ! } else { ! // If a connection is established to the Bugzilla server then rely ! // completely on it for the appropriate error message to show. ! while (!feof($bugzilla)) { ! $line = fgets($bugzilla, 2048); ! echo $line; ! } ! } ! } ! } ! ?> \ No newline at end of file |