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 5 of 5
  1. #1
    New to the CF scene
    Join Date
    Jun 2007
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Notice warnings and performance

    Hi all


    I was wondering if a site which has thousands of simple notice warnings about undefined variable will be suffering by degraded performance even if it is not logged in either a file or displayed?

    I know that the I/O performance will be degraded if it needs to log all the notice warnings but will it still be some sort of degrading performance if the log is off?

    Does PHP engine still need to process these notices in someway?


    Thx in advance

    /Ivik Team

  • #2
    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
    You can turn error_reporting off. I still think it goes into a log somewhere though if a site has that many notice warnings/errors then it needs to be fixed.
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #3
    New to the CF scene
    Join Date
    Jun 2007
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I know you can set it to OFF, but does the PHP Engine still process all the errors in someway? If you turn it off it does not display them or log them to a file, but does it still get proceed or is it like the errors never existed (coding is done the way the engine wants it)?

  • #4
    Senior Coder CFMaBiSmAd's Avatar
    Join Date
    Oct 2006
    Location
    Denver, Colorado USA
    Posts
    3,146
    Thanks
    2
    Thanked 333 Times in 325 Posts
    The error reporting just determines what is output to the browser. Turning it off just stops the last step in the error detection logic of adding the message to output content.

    Turning off logging to the log file and/or suppressing errors using an @ would be a bad idea as you would then have no idea why your code is not working and since you are discussing code that has numerous notice and warnings, it is a pretty good bet that the code itself has no error checking of things like failed function calls...

    Short answer, yes there is a performance hit, because PHP is trying to figure out what you are trying to do with the code. For something like an undefined variable, php must search through all the defined variables trying to find the name you are referencing and when it gets to the end of the list without finding a match, it defaults to the error processing code that figures out what to do. The error processing code figures out what to do in the code for the current reference to the undefined variable (this is repeated for each reference to the same variable), figures out if error logging is enabled and writes the error to the log file, and figures out the current error reporting level and outputs the message to the browser if needed.

    It is always best to write code that does not normally cause any notice/warning messages to be generated.

    Edit: If your code is written to be as bullet-proof as possible and has error checking, error reporting, and error recovery logic and then if a notice/warning is logged it would indicate that an un-expected condition occurred that your code was not testing for. The notice/warning would let you know of a weak area in your logic where you need to put in some additional checking logic. Generation of notice/warnings should be the exception, not the norm. If you have code that is generating a long list of these, fix them, don't try to suppress them after the fact.
    Last edited by CFMaBiSmAd; 07-25-2007 at 04:21 PM. Reason: fixed word, added more info
    If you are learning PHP, developing PHP code, or debugging PHP code, do yourself a favor and check your web server log for errors and/or turn on full PHP error reporting in php.ini or in a .htaccess file to get PHP to help you.

  • #5
    New to the CF scene
    Join Date
    Jun 2007
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Then it seems that there is nothing to do then fix all the notice issues...
    That's the thx you get for taking over somebodies ****ty code...

    Thack u all for all your help!


  •  

    Posting Permissions

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