Common Style Mistakes, Part 1
Subject:   E_ALL error reporting is a good thing
Date:   2003-05-30 07:14:03
From:   anonymous2
An additional hint: If you set error_reporting to E_ALL (via php.ini, .htaccess, or ini_set() in your script) many "style mistakes" like these (though not all of these) will be flagged for you. It's a great way to make sure you are not perpetuating deprecated syntax in your scripts. Running my dev server that way has cleaned up my code a lot -- for example, if I reference a variable without assigning something to it first, I get an error message. That one alone has saved me hours of debugging time.


Main Topics Oldest First

Showing messages 1 through 2 of 2.

  • E_ALL error reporting is a good thing
    2003-06-02 08:14:34  anonymous2 [View]

    I couldn't agree more, it helps you write clean code, and catch misspellings in variables (especially case-sensitivity issues with variables).

    $firstName = $theUser->firstName();
    return $firstname;

    This would generate a warning, because $firstname is undefined (should be $firstName).

    Another frustrating thing is when evaluating open-source code which was NOT developed with error_reporting E_ALL, and there are hundreds of errors all over the place, and then I need to make a custom .htaccess file to disable errors for a certain dir, and generally have a bad impression of the software before I even try it out! So, it's definitely possible to write functioning code without error_reporting on strict mode, but keep in mind that other people who use your code might see this as sloppy.
  • E_ALL error reporting is a good thing
    2003-06-02 02:22:22  John Coggeshall | O'Reilly Author [View]

    Setting your error_reporting level to E_ALL is an excellent setting during development, as notices which are usually ignored are displayed.

    However, as you correctly pointed out this is for a development server only! Once a site is in a production environment it is recommended error reporting be turned off completely.