Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Regular Coder
    Join Date
    Jan 2006
    Location
    Finland, Hollola
    Posts
    285
    Thanks
    8
    Thanked 0 Times in 0 Posts

    Can someone simplify this error_reporting code?

    Hello,

    I have this:

    Code:
    error_reporting(E_ERROR | E_PARSE | E_NOTICE | E_WARNING | E_CORE_ERROR | E_CORE_WARNING | E_USER_ERROR | E_USER_WARNING | E_USER_NOTICE);
    I want to show all errors EXCEPT E_STRICT, because my wysiwyg produces strict errors.

    Since PHP 5.3 I guess, E_STRICT is part of E_ALL, and I can not type E_ALL & ~E_STRICT because in PHP 4.x it will throw an error, because PHP 4 does not know E_STRICT.
    PHP 5 & MySQL 5 (Y)

  • #2
    Senior Coder
    Join Date
    Jan 2007
    Posts
    1,648
    Thanks
    1
    Thanked 58 Times in 54 Posts
    Since PHP 5.3 I guess, E_STRICT is part of E_ALL, and I can not type E_ALL & ~E_STRICT because in PHP 4.x it will throw an error, because PHP 4 does not know E_STRICT.
    There are still hosts out there that use PHP4? Supporting PHP4 is like supporting IE5, it's rather a pointless effort.

    Either way, if your long version works I think you'll just have to stick with that.

  • #3
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    According to the Change Log E_STRICT isn't part of E_ALL until PHP 6.
    ChangeLog

    Version Description
    5.0.0 E_STRICT introduced (not part of E_ALL).
    5.2.0 E_RECOVERABLE_ERROR introduced.
    6 E_STRICT became part of E_ALL.

    I guess you could do this
    PHP Code:
    <?php
    if(substr(phpversion(),0,1) == '4')
    {
    error_reporting(E_ALL);
    }
    else
    {
    error_reporting(E_ALL & ~E_STRICT);
    }
    ?>
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • Users who have thanked _Aerospace_Eng_ for this post:

    kaisellgren (05-15-2008)

  • #4
    Regular Coder
    Join Date
    Jan 2006
    Location
    Finland, Hollola
    Posts
    285
    Thanks
    8
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by _Aerospace_Eng_ View Post
    According to the Change Log E_STRICT isn't part of E_ALL until PHP 6.
    ChangeLog

    Version Description
    5.0.0 E_STRICT introduced (not part of E_ALL).
    5.2.0 E_RECOVERABLE_ERROR introduced.
    6 E_STRICT became part of E_ALL.

    I guess you could do this
    PHP Code:
    <?php
    if(substr(phpversion(),0,1) == '4')
    {
    error_reporting(E_ALL);
    }
    else
    {
    error_reporting(E_ALL & ~E_STRICT);
    }
    ?>
    That's a good idea, I'm going to use it, thank you
    PHP 5 & MySQL 5 (Y)


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •