John Coggeshall wrote:
|I know this is possible now, but not within the error handling
|function of PHP, or without setting a custom error handler.
Well, it's not really possible now -- a E_PARSE won't get thrown to a
custom PHP handler, it'll just die with a parse error.
It is possible. Not pretty but still possible :) You
can use a series of hacks to make PHP behave and allow
you to intercept an fatal error, and extract the error
message.
In short:
* You use auto_append to append a short PHP file that
only sets a flag to true
* You install a custom error handle to handle "normal"
errors.
* You need to turn the output buffering on.
* You register a shutdown function the checks the flag;
if the flag is set to false - you have a fatal error
on your hands. In that case you need to clear the
output buffer but not before you extract the fatal error
message (you need to have display_errors set to on).
Then you can forward the fatal error to your normal
error handler for processing.
The full explanation is available here:
http://www.webkreator.com/php/configuration/foolproof-php-handling-2.html
I do not recall the version I used and I haven't checked
whether this still works with recent releases. It did work
at the time.
Bye,
Ivan
--
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, visit: http://www.php.net/unsub.php