Oh, sorry. The patch was filtered :)
I am sendig it again.
It is sapi independent.
Thanks. Dmitry.
> -----Original Message-----
> From: Uwe Schindler [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, June 13, 2007 9:08 PM
> To: 'Dmitry Stogov'; [EMAIL PROTECTED]
> Cc: 'internals Mailing List'; 'Stanislav Malyshev'; 'Andrei
> Nigmatulin'
> Subject: RE: [PHP-DEV] FW: php fastcgi
>
>
> Where is the propsed patch? I was thinking about a (not SAPI
> specific the subject indicates!!!!) modification to the
> php-output parts that sends a HTTP status "500" when a fatal
> error occurs and no output was yet send (SAPI did not start
> the response). I think there is no need for a configuration
> setting. A CGI program that crashes on startup creates error
> 500, a servlet/JSP that does not startup creates error
> 500,... In principle SAPI should return a FAILURE to the
> webserver from the handler function and set the status code
> before. The webserver then generates the default error page.
>
>
> -----
> Uwe Schindler
> [EMAIL PROTECTED] - http://www.php.net
> NSAPI SAPI developer
> Bremen, Germany
>
> > -----Original Message-----
> > From: Dmitry Stogov [mailto:[EMAIL PROTECTED]
> > Sent: Wednesday, June 13, 2007 6:54 PM
> > To: [EMAIL PROTECTED]
> > Cc: 'internals Mailing List'; 'Stanislav Malyshev'; 'Andrei
> > Nigmatulin'
> > Subject: RE: [PHP-DEV] FW: php fastcgi
> >
> > Configuaratin option make sense, but PHP already has too many
> > configuration options especialliy for error reprting.
> > I would like to avoid new ones.
> >
> > Thanks. Dmitry.
> >
> > > -----Original Message-----
> > > From: Richard Lynch [mailto:[EMAIL PROTECTED]
> > > Sent: Wednesday, June 13, 2007 8:17 PM
> > > To: Dmitry Stogov
> > > Cc: 'internals Mailing List'; Stanislav Malyshev; Andrei
> Nigmatulin
> > > Subject: Re: [PHP-DEV] FW: php fastcgi
> > >
> > >
> > > On Wed, June 13, 2007 2:07 am, Dmitry Stogov wrote:
> > > > Current time most PHP instalations use setting
> > > 'display_error=0'. This
> > > > setting hides errors from user but may send to him just a
> > > blank page.
> > > >
> > > > The proposed patch sends HTTP 500 response on errors
> > > instead of blank
> > > > pages. The pages that already wrote something are not affectd.
> > > >
> > > > Any objections or additions?
> > >
> > > This sounds perfectly reasonable...
> > >
> > > But I suspect some users might prefer a 404 or a customizable
> > > response of some type...
> > >
> > > At the risk of incurring the wrath of list members, perhaps yet
> > > another php.ini configuration switch could be considered?...
> > >
> > > I wouldn't hold up the 500 patch for long with this kind of
> > > discussion, but it's worth taking a few minutes to consider, I
> > > think.
> > >
> > > --
> > > Some people have a "gift" link here.
> > > Know what I want?
> > > I want you to buy a CD from some indie artist.
> > > http://cdbaby.com/browse/from/lynch
> > > Yeah, I get a buck. So?
> > >
> >
> > --
> > PHP Internals - PHP Runtime Development Mailing List
> > To unsubscribe, visit: http://www.php.net/unsub.php
>
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: http://www.php.net/unsub.php
>
Index: main/main.c
===================================================================
RCS file: /repository/php-src/main/main.c,v
retrieving revision 1.640.2.23.2.35
diff -u -p -d -r1.640.2.23.2.35 main.c
--- main/main.c 18 Apr 2007 09:38:56 -0000 1.640.2.23.2.35
+++ main/main.c 21 May 2007 10:39:01 -0000
@@ -834,17 +834,29 @@ static void php_error_cb(int type, const
/* no break - intentionally */
case E_ERROR:
case E_RECOVERABLE_ERROR:
- /* case E_PARSE: the parser would return 1 (failure), we can
bail out nicely */
+ case E_PARSE:
case E_COMPILE_ERROR:
case E_USER_ERROR:
EG(exit_status) = 255;
if (module_initialized) {
- /* restore memory limit */
- zend_set_memory_limit(PG(memory_limit));
- efree(buffer);
-
zend_objects_store_mark_destructed(&EG(objects_store) TSRMLS_CC);
- zend_bailout();
- return;
+ if (!PG(display_errors) &&
+ !SG(headers_sent) &&
+ SG(sapi_headers).http_response_code == 200)
{
+ sapi_header_line ctr = {0};
+
+ ctr.line = "HTTP/1.0 500 Internal
Server Error";
+ ctr.line_len = strlen(ctr.line);
+ sapi_header_op(SAPI_HEADER_REPLACE,
&ctr TSRMLS_CC);
+ }
+ /* the parser would return 1 (failure), we can
bail out nicely */
+ if (type != E_PARSE) {
+ /* restore memory limit */
+ zend_set_memory_limit(PG(memory_limit));
+ efree(buffer);
+
zend_objects_store_mark_destructed(&EG(objects_store) TSRMLS_CC);
+ zend_bailout();
+ return;
+ }
}
break;
}
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php