3 ms·
There are at least three ways of handling errors - return codes, trigger_error(), and exceptions, all of which are handled differently and used inconsistently b
by kls 16y ago
There are at least three ways of handling errors - return codes, trigger_error(), and exceptions, all of which are handled differently and used inconsistently by functions and libraries, and require messing with various combinations of global settings to cause errors display or not display to the user. There are furthermore no agreed-upon conventions for handling errors, so libraries freely mix all of these methods along with directly printing errors to the output which is impossible to trap.
For me this was a show stopper for using PHP for anything other than maintaining existing stuff that we inherit (and only for clients we really like).
error handling is at its core a foundation to quality, without proper error handling you have to put in significant effort to build a quality product because the structure has to be reinforced at every level. Having multiple ways to handle errors is almost worse than having none at all. This is one area that really needs to be standardized and have "the one way" to do it. Good or bad, it allows everyone to know what to expect.
It is just my opinion but, this one flaw makes PHP one of the worst languages I have ever use, which is sad because Wordpress and Drupal are great products but I can't stand to have to work in PHP, if I have a project that I know will not require custom development, I use Wordpress or Drupal I really wish they supported alternative languages for writing custom modules,It would be nice to be able to write them in Python or hell even JavaScript has proper error handling.