
Okay, they said IT COULDN'T be done, there's no way to catch a php fatal error. I DISAGREE! :)
This simple module will catch any fatal error that may arise in the normal working of your site - we mod and change things, and even to the best of us, someone will find a way to break it.
This will stop the very unprofessional way php handles errors, and will pop up an alert that redirects them to your homepage (visitor) or member.php (logged in).
It will send you a mail, to the email you provided as bug reports (when setting up dolphin) so you know the php file, line, and error (making fixing the problem even easier!!!)
-
SIMPLE install, and this mod will help you fix your site problems. Plus, I just love when someone tells
you its impossible to do something, only those things which we close our eyes to become impossible!
-
Enjoy,
Chris
|
Correct line ..... Parse error: syntax error, unexpected T_STRING in /home/xxxxxx/public_html/dolphin/join.php on line 33
Did not return to root ..... stayed on error page .....
Did not send email .....
Tried several times ..... several files ..... all the same ..... .
|
Interesting.
That shouldn't have happened. I will have to investigate. What version of php? It shouldn't matter, just don't understand why it didn't catch it.
.....Thinking. I really am not sure - it works great on the four servers I have it installed. Only time it won't catch is if the error is before the header file is called.
Will have to check. Anyone else this didn't work for? Trying to isolate the problem....
Chris
|
RumpyBumpy,
AH`-`my own mistake!! In my instructions I had you just add gibberish to throw a fatal, and that throws a parse error. Parse errors are actually handled within php error handler:
E_ERROR => 'Error', E_WARNING => 'Warning', E_PARSE => 'Parser Error', E_NOTICE => 'Notice', E_CORE_ERROR => 'Core Error', E_CORE_WARNING => 'Core Warning', E_COMPILE_ERROR => 'Compile Error', E_COMPILE_WARNING => 'Compile Warning', E_USER_ERROR => 'User Error', E_USER_WARNING => 'User Warning', E_USER_NOTICE => 'User Notice', The only error uncatchable is a FATAL error. There are all kinds of ways to get fatal errors, I guess add this:
iwishitworked();
this is a function that doesn't exist - thats a fatal error. It will catch that. There are others.... :)
Sorry for the confusion - try adding that function - then tell me if it works. I know that seems arbitrary, but fatal errors occur when working with array's and other functions too. Through normal use, a fatal error is usually thrown when something is used incorrectly, or hacked, etc...
Changing my instructions now.... thanks, and sorry!!
Chris
|
After even more research - ANY error thrown during run time WILL get caught. The parse error is part of the file that is calling the header file, which indeed calls my error handler. Well, if you have a parse error on the file you are calling, it never loads my error handler, as the parse error stops it - therefore, not caught.
--
Under normal operation of your site, if something goes wrong, my handler will catch it.
--
Again, sorry for the confusion.
Chris
|
Revised instructions. Again, thanks rumpybumpy for reminding me not to write instructions at 5:20 in the morning 
Chris
|
Correct line ..... Fatal error: Call to undefined function iwishitworked() in /home/xxxxxx/public_html/dolphin/join.php on line 33
Did not return to root ..... stayed on error page .....
Did not send email .....
Tried several times ..... several files ..... all the same .....
ummmmm ..... is it supposed to work or not? .
|
It works, and well. I am at a loss as to why it doesn't work for you. If you want me to look at it I gladly will. It works without question on my server, and on my other vps.
Its quite simple in design. Unless dolphin 6.1.4 clears the ob handlers. I don't think so.
Please, someone else try and let me know.
Thanks.
|
Correct line ..... Fatal error: Call to undefined function iwishitworked() in /home/xxxxxx/public_html/dolphin/join.php on line 33
Did not return to root ..... stayed on error page .....
Did not send email .....
Tried several times ..... several files ..... all the same .....
ummmmm ..... is it supposed to work or not? .
I just tested it on a site I am working on (sorry tom for the error :) - it worked without question, dolphin 6.1.4
It has to be how php is handling your ob handlers.
I would need to test it.
|
function redirect timeout error
What can I do here. When I corrected my 'fault' and did a refresh, I got an sorry about that type message and then it went back to my homepage.
Stuart
There are none so blind as those that will not see. |
function redirect timeout error
What can I do here. When I corrected my 'fault' and did a refresh, I got an sorry about that type message and then it went back to my homepage.
Stuart
Um, which php file did you try the fault on?
You created a loop - meaning it couldn't redirect, as it was always redirecting - an endless loop. Its working, you tried index.php didn't ya? :) or one of the .inc.php will also give an endless loop - neither is probable in real production environment. It's working!
----
Chris
|
I'm going to update my code - that endless loop bothers me. Either redownload the zip or make these changes:
In catch_fatal.php change:
require_once( 'inc/header.inc.php' ); require_once( BX_DIRECTORY_PATH_INC . 'design.inc.php' ); require_once( BX_DIRECTORY_PATH_INC . 'admin.inc.php' ); require_once( BX_DIRECTORY_PATH_INC . 'utils.inc.php' );
check_logged(); $ref = $site['url'];if ($logged['member']){$ref=$site['url'].'member.php';}
TO:
require_once( 'inc/header.inc.php' ); $ref = $site['url'];if ((int)$_COOKIE['memberID']>0){$ref=$site['url'].'member.php';}
That will stop it.
|
Thanks Chris, I will test and get back to you!
Stuart
I'm going to update my code - that endless loop bothers me. Either redownload the zip or make these changes:
In catch_fatal.php change:
require_once( 'inc/header.inc.php' ); require_once( BX_DIRECTORY_PATH_INC . 'design.inc.php' ); require_once( BX_DIRECTORY_PATH_INC . 'admin.inc.php' ); require_once( BX_DIRECTORY_PATH_INC . 'utils.inc.php' );
check_logged(); $ref = $site['url'];if ($logged['member']){$ref=$site['url'].'member.php';}
TO:
require_once( 'inc/header.inc.php' ); $ref = $site['url'];if ((int)$_COOKIE['memberID']>0){$ref=$site['url'].'member.php';}
That will stop it.
There are none so blind as those that will not see. |
- just realized you could also use this routine to speed up your dolphin if your php was compiled with gzip handlers. Most are, if interested, PM me. |