How to get error context
| From: | It Maq | Date: | Thu, 13 Mar 2008 19:28:15 +0000 |
| Subject: | How to get error context | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-271534@lists.php.net to get a copy of this message | ||
Hi,
i need help because I'm unable to retrieve error's context. Below is the code that is
working perfectly except the context that is not displayed:
<?php
function error_handler($errno, $errstr, $filename, $lineno, $errcontext)
{
$str = "";
$str .= "<br><br>ERROR Number: ". $errno;
$str .= "<br>ERROR MESSAGE: ". $errstr;
$str.= "<br>File: ". $filename;
$str.= "<br>Line number: ". $lineno;
$str.= "<br>Context: ". $errcontext[0];
echo $str;
}
echo "<h1>Testing set_error_handler</h1>";
error_reporting(0);
set_error_handler('error_handler');
ini_set('error_reporting', 0);
//trigger_error("The string for testing the error", E_USER_WARNING);
$ourFileName = "testFile.txt";
$fh = fopen($ourFileName, 'X');// or die("Can't open file");
fclose($fh);
?>
____________________________________________________________________________________
Be a better friend, newshound, and
know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ