hallaplay835 Posted July 18, 2012 Share Posted July 18, 2012 Hey there. On pages 52 (where the script is displayed) and 56 (where the steps are outlined), in the error handling function, a conditional checks to see whether the error type is either E_NOTICE or E_STRICT. If they are, Larry suggests "no message error should be printed, as the error is likely not interfering with the operation of the page". Since PHP 5 the E_STRICT constant has had a value of 2048, so the conditional should check whether $e_number equals 2048 for this type of error. Shouldn't then the conditional printed in the book: if (($e_number != E_NOTICE) && ($e_number < 2048)) { be rewritten to: if (($e_number != E_NOTICE) && ($e_number != 2048)) { Why would we want to check for a smaller than 2048 error code value? In case an E_STRICT error occurred the page would still display the generic error message. Link to comment Share on other sites More sharing options...
Larry Posted July 18, 2012 Share Posted July 18, 2012 No, you want to rule out 2048 and above, because those are E_STRICT and deprecated notices. With your version, an E_DEPRECATED message would result in an error being displayed despite the fact that the code actually does work as written (i.e., it may not work in the future but it works fine now). Link to comment Share on other sites More sharing options...
hallaplay835 Posted July 18, 2012 Author Share Posted July 18, 2012 Oh, I see. Not sure if we wouldn't want to display an error message in case it is an E_RECOVERABLE_ERROR, PHP manual should give examples of each type of error and not just an abstract description. But now your version makes sense; should have looked into this further before posting. Also ignore what I said in my earlier post, E_STRICT errors wouldn't cause the error message to be displayed, don't know where my logic went wrong. Nevertheless, this should have been mentioned in the book; maybe you'll want to include it in your upcoming edition. By the way, Larry, I have not gone into this one too much but I sense this is yet another of your excellent books among the others I have read from you. Keep up the great work! Link to comment Share on other sites More sharing options...
Antonio Conte Posted July 18, 2012 Share Posted July 18, 2012 Constants > Values. Link to comment Share on other sites More sharing options...
Recommended Posts