From: David R. <da...@ro...> - 2010-07-21 18:30:02
|
I'm not sure if this is going to fix your problem, but taking a quick look at my code that does something similar, I have the first element in the array parameter is a new instance of the class that wraps the error handler method. set_error_handler(array(new CZ_ErrorHandle(),'handleError')); I don't have a sandbox handy to test it out, though. On Wed, Jul 21, 2010 at 12:54 PM, Trevor Oldak <tr...@gm...> wrote: > There's a differnce between a *file name *and a *class name. * > * > The file IS BEING INCLUDED because it is changing the error handler. The > CLASS is not loading, though. > * > On 21 July 2010 12:28, matt donohue <mm_...@ya...> wrote: > >> Well- the error is pretty specific. Whatever that path is, it is not >> correct. >> Instead of a relative path try swapping in the full path and see what >> happens. >> >> As for the autoload- all the class names should be the exact same as the >> file >> name and you can do something simple once in your config. >> >> function __autoload($str_classname) { >> global $root; >> if(file_exists($root."classes/".$str_classname.".inc")) >> { >> require_once($root."classes/".$str_classname.".inc"); >> } >> } >> >> >> >> ________________________________ >> From: Trevor Oldak <tr...@gm...> >> To: Chicago PHP User Group <chi...@li...> >> Sent: Wed, July 21, 2010 12:15:04 PM >> Subject: Re: [chiPHPug-discuss] Strange PEAR/include file error >> >> What's further exasperating about this error... If I change something like >> a >> comment or some whitespace in the code, it will fix the error for about 24 >> hours, and then the error mysteriously appears again. >> >> On 21 July 2010 12:10, Trevor Oldak <tr...@gm...> wrote: >> >> > *What way ==> That way. >> > >> > >> > On 21 July 2010 12:10, Trevor Oldak <tr...@gm...> wrote: >> > >> >> If you're talking about this line from my above code: >> >> >> >> require_once('CZ/ErrorHandler.php'); >> >> That is actually correct. Our libary has multiple folders, and we named >> >> our classes according the the library path so that it was easy to locate >> the >> >> code for each class, and each class would have a unique name. >> >> >> >> What way, when we have a Formatter class for phone numbers, and a >> >> Formatter class for email addresses, one can be Lib_Email_Formatter and >> the >> >> other can be Lib_Phone_Formatter nad we won't have conflicting Formatter >> >> class names. >> >> >> >> The include path I've posted is correct. >> >> >> >> >> >> On 21 July 2010 12:01, matt donohue <mm_...@ya...> wrote: >> >> >> >>> Hey Trevor, >> >>> >> >>> require_once('CZ/ErrorHandler.php'); >> >>> Should have an underscore. >> >>> >> >>> Also- you should look at PHP's autoload and get rid of that include >> junk. >> >>> >> >>> >> >>> Regards, >> >>> Matt >> >>> >> >>> >> >>> ________________________________ >> >>> From: Trevor Oldak <tr...@gm...> >> >>> To: Chicago PHP User Group <chi...@li...> >> >>> Sent: Wed, July 21, 2010 11:47:23 AM >> >>> Subject: [chiPHPug-discuss] Strange PEAR/include file error >> >>> >> >>> I set up our software platform where I work to email me whenever a >> >>> serious >> >>> error occurs. I set up a class that handles errors: >> >>> <?php >> >>> class CZ_ErrorHandler{ >> >>> public static function handleError($errno, $errstr, $errfile, >> >>> $errline, >> >>> $errcontext){ >> >>> ... >> >>> } >> >>> } >> >>> >> >>> set_error_handler(array('CZ_ErrorHandler','handleError')); >> >>> ?> >> >>> >> >>> set_error_handler does allow an array as an argument to handle all >> >>> errors. >> >>> >> >>> I put this at the top of each php page: >> >>> <?php >> >>> require_once('CZ/ErrorHandler.php'); >> >>> ... >> >>> ?> >> >>> It's the first file included in each page, and it links to the code >> >>> above. >> >>> >> >>> However, I get this error when exporting to XLS through pear: >> >>> >> >>> *Fatal error*: Class 'CZ_ErrorHandler' not found in * >> >>> /usr/share/pear/Spreadsheet/Excel/Writer/Workbook.php* on line *180 >> >>> >> >>> >> >>> *The ONLY place where set_error_handler is in the CZ/ErrorHandler.php >> >>> file. >> >>> The script wouldn't know to use my error handler unless it had first >> >>> declared that class. >> >>> >> >>> So how the heck is this error happening? >> >>> >> >>> -Trevor >> >>> >> >>> >> >> >------------------------------------------------------------------------------ >> >>> This SF.net email is sponsored by Sprint >> >>> What will you do first with EVO, the first 4G phone? >> >>> Visit sprint.com/first-- http://p.sf.net/sfu/sprint-com-first >> >>> _______________________________________________ >> >>> chiPHPug-discuss mailing list >> >>> chi...@li... >> >>> https://lists.sourceforge.net/lists/listinfo/chiphpug-discuss >> >>> >> >>> >> >> >------------------------------------------------------------------------------ >> >>> This SF.net email is sponsored by Sprint >> >>> What will you do first with EVO, the first 4G phone? >> >>> Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first >> >>> _______________________________________________ >> >>> chiPHPug-discuss mailing list >> >>> chi...@li... >> >>> https://lists.sourceforge.net/lists/listinfo/chiphpug-discuss >> >>> >> >> >> >> >> > >> >> ------------------------------------------------------------------------------ >> This SF.net email is sponsored by Sprint >> What will you do first with EVO, the first 4G phone? >> Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first >> _______________________________________________ >> chiPHPug-discuss mailing list >> chi...@li... >> https://lists.sourceforge.net/lists/listinfo/chiphpug-discuss >> >> ------------------------------------------------------------------------------ >> This SF.net email is sponsored by Sprint >> What will you do first with EVO, the first 4G phone? >> Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first >> _______________________________________________ >> chiPHPug-discuss mailing list >> chi...@li... >> https://lists.sourceforge.net/lists/listinfo/chiphpug-discuss >> > ------------------------------------------------------------------------------ > This SF.net email is sponsored by Sprint > What will you do first with EVO, the first 4G phone? > Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first > _______________________________________________ > chiPHPug-discuss mailing list > chi...@li... > https://lists.sourceforge.net/lists/listinfo/chiphpug-discuss > |