) remains the owner of the code. Any person may use this code in their own scripts as long as this file is not modified and this notice remains intact. To ensure that you have the latest version of this code please visit: http://www.phpmachine.com/error-handler/ If you have any suggestions please contact: http://www.phpmachine.com/ info@phpmachine.com ****************************************************************/ ?> "; function GetErrorDescription($a_iType, $a_sMsg, $a_sFile, $a_iLine, $a_aContext){ $l_aErrorTypes = array(E_ERROR=>"E_ERROR", // used to get a word-based error code E_WARNING=>"E_WARNING", // instead of the number that will be E_NOTICE=>"E_NOTICE", // passed to this function E_USER_ERROR=>"E_USER_ERROR", E_USER_WARNING=>"E_USER_WARNING", E_USER_NOTICE=>"E_USER_NOTICE" ); // TABLE 1: Error overview $l_sErrorDesc = "
| Error type: | {$l_aErrorTypes[$a_iType]} |
| Message: | $a_sMsg |
| Location: | $a_sFile (line: $a_iLine) |
\n";
$l_sCode = file_get_contents($a_sFile,TRUE); // get source code
$l_aCode = preg_split("#\\n#i",$l_sCode); // split into individual lines
$l_sDispCode = ""; // this will store the HTML version of the code
for($i=($a_iLine-15);$i<=($a_iLine+15);$i++){ // display 15 lines either side of the line that caused the error
if(($i+1)==$a_iLine){ $l_sDispCode .= "
"; } AddToolTips($a_aContext, $l_sDispCode); $l_sErrorDesc .= $l_sDispCode . " |
| Variables: "; $l_sVarDump = ""; // this will store the HTML for the variable tree CreateVarDump($GLOBALS,$l_sVarDump,0); $l_sErrorDesc .= $l_sVarDump . " |
Do you need help fixing this error? do you need a PHP script modofied, or even developed from scratch? If so visit PHPMachine today for a free no-obligations quotation. We guarantee that our price will be the cheapest that you find.
"; return $l_sErrorDesc; } function CreateVarDump($variable, &$a_sHTML, $a_iLevel){ /* Recursive function to create tree like structure of all variables */ foreach($variable as $l_sVarName=>$l_mValue){ if($l_sVarName!="GLOBALS"){ // stop infinite loops $a_sHTML .= "