[PATCH] Improve the error handler

Please report bugs here!

Moderator: Thorsten

Post Reply
bram
Posts: 19
Joined: Mon Aug 16, 2010 12:54 pm

[PATCH] Improve the error handler

Post by bram » Mon Aug 16, 2010 4:45 pm

Currently the custom error handler of phpMyFaq sends all errors to the screen.
This is not very flexible and does not allow the errors to be send to the syslog and/or a log file.

Improve this by changing the error handler to respect the values: 'display_errors' and 'log_errors'.
In addition: use the error_log when the 'log_errors' variable is set in the php configuration.

Attached is a patch for this (0002-Repsect-the-values-of-dislpay_errors-and-log_errors.patch).
NOTE: this patch was originally written on 2.6.7. It is untested on the git HEAD.
You do not have the required permissions to view the files attached to this post.

Thorsten
Posts: 14758
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Re: [PATCH] Improve the error handler

Post by Thorsten » Tue Aug 17, 2010 6:54 pm

Hi,

I cleaned your patch a little bit and added it phpMyFAQ 2.6.8. Thanks a lot!

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist

bram
Posts: 19
Joined: Mon Aug 16, 2010 12:54 pm

Re: [PATCH] Improve the error handler

Post by bram » Thu Aug 19, 2010 7:40 am

I noticed that I made a mistake in the patch...

My patch uses

Code: Select all

 printf ($errorMessage);
which is not correct.
It should be:

Code: Select all

 printf ("%s", $errorMessage);
or

Code: Select all

 print ($errorMessage);

Thorsten
Posts: 14758
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Re: [PATCH] Improve the error handler

Post by Thorsten » Thu Aug 19, 2010 8:43 am

Hi,

yes, I fixed it. Thanks for the hint!

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist

Post Reply