php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #7283 Error message failure with custom Error Handler
Submitted: 2000-10-17 11:57 UTC Modified: 2000-12-30 20:19 UTC
From: kway at wgate dot com Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 4.0 Latest CVS (17/10/2000) OS: FreeBSD
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: kway at wgate dot com
New email:
PHP Version: OS:

 

 [2000-10-17 11:57 UTC] kway at wgate dot com
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'

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-11-23 07:44 UTC] stas@php.net
Works for me. Please try latest version - does it fix this
issue?
 [2000-12-30 20:19 UTC] sniper@php.net
No feedback. Considered fixed.

--Jani
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Sat Oct 10 07:00:01 2026 UTC