In this question the OP mentions PHP throwing a 500 error automatically when error_reporting
is off, and XDebug changing that behaviour.
That got me curious, as I've never heard of PHP automatically emitting 500s before. According to various quotes and answers on SO and elsewhere, it seems to indeed be PHP's default behaviour to throw a 500 Internal Server Error
header if display_errors
is set to false.
However, I am unable to find anything official on this. The manual pages on display_errors and error_reporting say nothing.
Does anybody know a good source in the PHP docs that talks about this?
Not sure, but this may have been added in PHP 5.2.4:
- Changed error handler to send HTTP 500 instead of blank page on PHP errors. (Dmitry, Andrei Nigmatulin)
There is also this discussion on the internals list that might be related:
Quoting:
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?
and the proposed solution/patch seems to be shown here:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With