Re: Feature request: ini setting for http 500 on fatal errors

From: Date: Thu, 19 Oct 2006 20:28:31 +0000
Subject: Re: Feature request: ini setting for http 500 on fatal errors
References: 1 2 3 4  Groups: php.internals 
Request: Send a blank email to internals+get-26096@lists.php.net to get a copy of this message
Brian Moon wrote:
Evert | Rooftop wrote:
Thats a smart idea.. I like that As for letting PHP do the 500, I tend to use output buffering everywhere (i think most people do, supposed to be faster too) so I'm used to setting header()'s wherever I need them..
You think wrong. There are very good reasons not to use output buffering. calm down :S
Besides, in most of my script the business logic gets executed first, and this is where most errors can happen.. only after the presentation is done. So the solution would be, if fatal error is triggered, and headers_sent() is false then set the error to 500..
This produces inconsistent behavior. I would not be in favor of it. I suggest you do as Rasmus suggested. Use register_shutdown_function() perhaps to have a function to change the status code before output is sent in your specific environment. Yea I do like that idea, didn't think of that approach.
As for inconsistent behaviour.. It's not a huge deal, and the situation can easily described in the documentation. But yea, this is also why I proposed an ini setting. Rasmus' solution solves my problem though. Thanks a lot! Evert

« previous php.internals (#26096) next »