PHP 4.0 Bug #7283: Error message failure with custom Error Handler
| From: | kway at wgate dot com | Date: | Tue, 17 Oct 2000 15:57:15 +0000 |
| Subject: | PHP 4.0 Bug #7283: Error message failure with custom Error Handler | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-35270@lists.php.net to get a copy of this message | ||
From: kway@wgate.com
Operating system: FreeBSD
PHP version: 4.0 Latest CVS (17/10/2000)
PHP Bug Type: Scripting Engine problem
Bug description: Error message failure with custom Error Handler
Using the following function as the error handler, the errormsg always ends up blank, though all
other fields get filled out as one would expect.
-------------------------------
script which reproduces problem
-------------------------------
function customErrorHandler ($errno, $errmsg, $filename, $linenum, $vars)
{
$dt = date("d-m-Y H:i:s (T)");
// What kind of errors can we get?
// we probably only care about (user)error, (user)warning, (user)notice
$errortype = array (
1 => "Error",
2 => "Warning",
4 => "Parsing Error",
8 => "Notice",
16 => "Core Error",
32 => "Core Warning",
64 => "Compile Error",
128 => "Compile Warning",
256 => "User Error",
512 => "User Warning",
1024=> "User Notice"
);
// set of errors for which a var trace will be saved
$user_errors = array(E_USER_ERROR, E_USER_WARNING, E_USER_NOTICE);
$err = "<errorentry>\n";
$err .= "\t<datetime>" . $dt . "</datetime>\n";
$err .= "\t<errornum>" . $errno . "</errornum>\n";
$err .= "\t<errortype>" . $errortype[$errno] . "</errortype>\n";
$err .= "\t<errormsg>" . $errmsg . "</errormsg>\n";
$err .= "\t<scriptname>" . $filename . "</scriptname>\n";
$err .= "\t<scriptlinenum>".$linenum."</scriptlinenum>\n";
if (in_array($errno, $user_errors))
$err .=
"<vartrace>\t".wddx_serialize_value($vars,"Variables")."</vartrace>\n";
$err .= "</errorentry>\n\n";
error_log($err, 3, "/var/log/php-error.log");
}
$old_error_handler = set_error_handler("customErrorHandler");
-----------------
configure command
-----------------
'./configure' '--with-imap' '--with-pgsql' '--with-gettext'
'--enable-snmp'
'--enable-track-vars' '--enable-wddx'
'--with-gd=/usr/local' '--enable-trans-sid'
'--disable-magic-quotes'
'--enable-short-tags' '--with-apxs=/usr/local/sbin/apxs'
'--without-mysql'
'--without-tsrm-pthreads' '--prefix=/suproot/usr/local'
--
Edit Bug report at: http://bugs.php.net/?id=7283&edit=1