Re: PHP 4 set_error_handler () Help?

From: Date: Sat, 22 Jul 2000 01:38:59 +0000
Subject: Re: PHP 4 set_error_handler () Help?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-7651@lists.php.net to get a copy of this message
The 4.0.1 version of this function expects a single argument, which is a name of a function. set_error_handler() replaces the built-in error handler with that function, or restores the built-in error handler if an empty string is supplied. It does not return anything. The function has to accept to arguments - the error type (which can be one of the various error types, E_WARNING, E_NOTICE, etc.) and the error message (which is a string). A simple illustrative example: function my_error_handler($type, $message) { print "Error occured: $message\n"; } set_error_handler("my_error_handler"); The CVS version (scheduled for 4.0.2) of the function has been enhanced: - The error handler accepts three additional arguments - the filename in which the error occured, the line number in which the error occured, and the context of the in which the error occured (a hash that points to the active symbol table at the place of the error). - set_error_handler() uses a stack - each time it's called, it pushes the old error handler onto a stack. You can use restore_error_handler() to pop the last error handler from the stack. Zeev On Fri, 21 Jul 2000, Paul Marais wrote: > Can someone please be kind enough to point me to info on creating custom > error handlers using this new function. The php documentation says > set_error_handler() can be used to write custom error functions overriding > the php internal error functions. > > > Thanks > > > Paul > > > -- Zeev Suraski <zeev@zend.com> http://www.zend.com/

« previous php.general (#7651) next »