Google Answers Logo
View Question
 
Q: Traping PHP E_PARSE errors ( No Answer,   1 Comment )
Question  
Subject: Traping PHP E_PARSE errors
Category: Computers > Programming
Asked by: uc1bear-ga
List Price: $25.00
Posted: 18 Jul 2005 16:26 PDT
Expires: 17 Aug 2005 16:26 PDT
Question ID: 545112
Is there a way to trap PHP E_PARSE errors?  We want to show the user a
"pretty error page" (and notify our techs), rather than just showing
the user the raw Parsing error.

The default PHP error handler overrides any user defined handlers for
the E_PARSE error so this error type cannot be handled with a user
defined function.

Maybe there is a way to generate a script error instead so that Apache
can redirect when an E_PARSE error occurs?  Thanks!
Answer  
There is no answer at this time.

Comments  
Subject: Re: Traping PHP E_PARSE errors
From: peter_b-ga on 24 Jul 2005 11:42 PDT
 
It is impossible to catch an E_PARSE error.  The reason is that this
error means the PHP interpreter has choked on the code provided -
therefore there is no way it can find and run an error handler that
you have written in your PHP code.

The only thing you can do is disable the error message from being
reported, which I would not recommend - this would show the user a
blank page instead of an error message.

Sorry I can't be more help!

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy