Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:26093 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 78934 invoked by uid 1010); 19 Oct 2006 19:34:12 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 78918 invoked from network); 19 Oct 2006 19:34:12 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 19 Oct 2006 19:34:12 -0000 Authentication-Results: pb1.pair.com header.from=rasmus@lerdorf.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=rasmus@lerdorf.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain lerdorf.com from 204.11.219.139 cause and error) X-PHP-List-Original-Sender: rasmus@lerdorf.com X-Host-Fingerprint: 204.11.219.139 lerdorf.com Linux 2.5 (sometimes 2.4) (4) Received: from [204.11.219.139] ([204.11.219.139:42054] helo=lerdorf.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 04/FA-27040-233D7354 for ; Thu, 19 Oct 2006 15:34:12 -0400 Received: from [10.224.11.106] (m010f36d0.tmodns.net [208.54.15.1]) (authenticated bits=0) by lerdorf.com (8.13.8/8.13.8/Debian-2) with ESMTP id k9JJY5B8004886; Thu, 19 Oct 2006 12:34:06 -0700 Message-ID: <4537D328.6080706@lerdorf.com> Date: Thu, 19 Oct 2006 12:34:00 -0700 User-Agent: Thunderbird 1.5.0.7 (Macintosh/20060909) MIME-Version: 1.0 To: evert@rooftopsolutions.nl CC: internals@lists.php.net References: <4537C21F.9070900@rooftopsolutions.nl> In-Reply-To: <4537C21F.9070900@rooftopsolutions.nl> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Feature request: ini setting for http 500 on fatal errors From: rasmus@lerdorf.com (Rasmus Lerdorf) Evert | Rooftop wrote: > Excuse me if this has been discussed before, but I would like to know > the stance on this issue, it's hard to search the buglist or mailing > archives on stuff like http, 500 and fatal. > > Would it be hard to implement an ini setting for throwing a http 500 > error on a fatal error? It's hard to make certain applications and have > proper error handling if there is no way to do anything on a fatal error.. > > It would be even grander if php could try to run a fall-back script when > something really bad happens, but just having that 500 on fatal errors > would be awesome .. > > If this is not going to happen anytime soon, would you accept a patch? How would you implement it. Fatal errors can happen after output has already been sent in which case it is too late to change the http status. And if you haven't sent anything yet, as in you are using output buffering, then it is rather trivial to do in user space. Simply start you script by setting the status to 500 and change it to 200 when you know you have good output to send. That way if a fatal error happens, the 500 will be sent. -Rasmus