Re: Custom error-handling creates "500 internal server error" [message #174406 is a reply to message #174403] |
Fri, 10 June 2011 11:22 |
Erwin Moller
Messages: 228 Registered: September 2010
Karma:
|
Senior Member |
|
|
On 6/10/2011 11:57 AM, Luke wrote:
> I'm sorry I don't get it. Does that mean I cannot use ob_xx functions in the register_shutdown_function callback? Because it *does* work, except it sends a 500 header. Also, if there aren't any errors and ob_end_flush(); is called, a 200 OK header is sent.
(Please stop using Google groups latest greatest interface to usenet.
Your answers appears as a fresh posting to many regular usenet (as in
n-=gg). Not in theright thread, but as a new top posting. I understand
that the former version does it right.)
To your question:
I think the manual is very clear:
"The shutdown functions are called as the part of the request so that
it's possible to send the output from them. There is currently no way to
process the data with output buffering functions in the shutdown function. "
So no, you cannot use your output buffering.
It is hard for me to help you with the 200 and 500 headers without
seeing the whole set-up: Where do the possible errors arise?
Are you using custum errorhandler routines? If so, how do they look?
Are you handling only errors or also exceptions?
And many more questions. :-)
However, I can tell you how I debug in difficult situations (eg, INSIDE
the errorhandler): create a simple function that appends to a file, or
sends you an email. Add a timestamp to the message.
something like:
function debug($someMessage){
// add timestamp and email to yourself, or append to some file.
}
Then, from places that are otherwise hard to debug, use that function.
I wasted many days before I started using that approach. ;-)
Sorry I cannot be of more help. Maybe somebody else can.
Good luck.
Regards,
Erwin Moller
--
"That which can be asserted without evidence, can be dismissed without
evidence."
-- Christopher Hitchens
|
|
|