#1
  1. Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Apr 2007
    Location
    in the ether
    Posts
    983
    Rep Power
    154

    Changing Error Reporting in php.ini


    Hello all,

    Is this correct when switching on all error types in the php.ini file:
    Code:
    error_reporting = E_ALL & E_NOTICE & E_STRICT
    I don't know the exact "wording" for the above.
    (can't look it up now, don't have PHP installed on this machine)

    Having everything switched on, can someone give me an example of when PHP will give me a E_NOTICE or a E_STRICT, because I am not sure if I have come across them before.

    Thanks all
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2008
    Posts
    53
    Rep Power
    19
    well, as far as I know setting error_reporting to E_ALL will contain E_NOTICE , etc ... too

    and about your second question : consider this code , dude :

    setcookie('x','string');
    error_reporting(E_ALL);
    ini_set('display_errors',true);
    echo $_COOKIE[x];

    notice string : Notice: Use of undefined constant x - assumed 'x' in somewhere ...

    P.S : setting display_errors to off (in php.ini or in the code by ini_set) will cause nothing to display , even you set error_reporting to E_ALL !

    hope it helps ,

    Comments on this post

    • JavaNinja agrees : Damn, can't rep you yet.
  4. #3
  5. Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Apr 2007
    Location
    in the ether
    Posts
    983
    Rep Power
    154
    Thanks for your reply and great example nima_a!

    I didn't think that the E_ALL would contain the other options since when I first installed PHP, the default was this:
    Code:
    error_reporting = E_ALL & ~E_NOTICE & ~E_STRICT
    So I assumed they were separate?? Maybe someone can confirm their inclusiveness?
  6. #4
  7. Contributing User
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    Mar 2006
    Location
    Hindustan
    Posts
    1,121
    Rep Power
    1309
    Confirmed .....
    http://bugs.php.net/bug.php?id=30314

    Comments on this post

    • JavaNinja agrees : Sweet, thanks.
    Trimbak D. Bankar.

IMN logo majestic logo threadwatch logo seochat tools logo