From: K. O. <web...@my...> - 2003-07-29 04:51:13
|
Looks nice. I will start modifying the core codes to use the trigger_error function. - Kazu ----- Original Message ----- From: "R. Michael van Dam" <mv...@ca...> To: <xoo...@li...> Sent: Tuesday, July 29, 2003 8:22 AM Subject: Re: [Xoops-development] addressing "blank page" problem > > I've commit to CVS a preliminary version of a new error handler for > review in class/errorhandler.php. Changes were also made in > include/common.php to 'activate' it. > > By default, I have turned on error reporting at the beginning, which later > gets turned off once the DB is connected and the config value > (debug_mode) can be read. > > It cannot trap PHP 'fatal' or 'parse' errors, so 'trigger_error' should be > added throughout the code where problems can be detected early. e.g. I > have modified common.php so if the database is not connected, an error is > triggered. (If the code were to continue instead, it would trigger a > 'fatal' error, "call to a member of a non-object" which cannot be > trapped.) When an error cannot be trapped, it leads to the blank page > problem (if server has display_errors Off). > > Currently an error triggered with type 'E_USER_ERROR' will add its message > then exit immediately. This should be used for unrecoverable problems > (such as not able to connect to DB). 'E_USER_WARNING' and 'E_USER_NOTICE' > can be used to print helpful diagnostics due to unexpected but not fatal > conditions. > > e.g. > > trigger_error("Encountered major error and cannot continue generating > page", E_USER_ERROR"); > > trigger_error("Encountered a less major problem which we can ignore > but here is a diagnostic message", E_USER_WARNING); > > > Anyways, please let me know if you like it. I can remove it / correct it > if anyone finds any problems with it. > > Regards, > > Mike > |