With all my REST and AJAX explorations, I have run into what I consider to be a fundamental issue in PHP's error handling: when the parser or interpreter runs into an error it will always return HTTP status code 200.
Semantically this is wrong. Here is the way it should be, at least in my eyes:
If PHP runs into a non-recoverable error (E_ERROR, E_PARSE, E_CORE_ERROR, E_CORE_WARNING, E_COMPILE_ERROR and E_COMPILE_WARNING; i.e. where the error cannot be trapped by
set_error_handler()), it should spit out a HTTP status code of 500 (Internal Server Error), and depending on the setting of the ini directive
display_errors display the error text, or conversely the standard Internal Server Error page.
Currently, PHP just tells the user that everything is A-OK, when it most definitely isn't. That is wrong.
The next version of meditation will allow some kind of configuration so that PHP errors properly return a 500 status code, and display a friendly error message. It won't help with parse errors, core errors or compiler errors, but the semantics will be a little closer to on-target.
Update: Welcome new visitors! Meditation is a BSD Licensed REST API framework that facilitates in building your own REST API. It needs beta testers!
It is available here.
If you are interested in any of my other PHP mumblings, check em out
Here.
This is more for my own reference rather then anyone else... Posted a feature request on bugs.php.net... Bug number 36636. This is long after ranting about it in one of my previous entries Here. This is similar to, but different from This bug where
Tracked: Mar 06, 11:38