note 61006 deleted from function.set-error-handler by nlopess

From: Date: Mon, 23 Jan 2006 11:33:19 +0000
Subject: note 61006 deleted from function.set-error-handler by nlopess
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-102288@lists.php.net to get a copy of this message
Note Submitter: Joe ---- Something that may not be obvious to everyone is that if you have an application with say, 10 .php pages, and you want your custom error handler to handle errors in each of them, then, you need to do a set_error_handler('my_err_handler'); or maybe set_error_handler('my_err_handler', E_USER_ERROR | E_USER_WARNING | E_USER_NOTICE); at the top of _every_ _script_ (similar to session_start() behavior if you are using sessions) Otherwise, your errors, generated using trigger_error(), will show up in the normal way PHP shows errors - like this: Warning: None###invalid op - this bad user is attempting to study the internals by setting op = 39487 in C:\xampp\htdocs\myapp\Controller.php on line 10 A good idea if you are using sessions($_SESSION) as well, is to make a function say, start_session() or init_page() and put all functions like set_error_handler() and session_start() inside that function and call it at the top of each page. HTH, Joe

« previous php.notes (#102288) next »