hallaplay835 0 Posted July 18, 2012 Report 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. Quote Link to post Share on other sites
Larry 428 Posted July 18, 2012 Report 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). Quote Link to post Share on other sites
hallaplay835 0 Posted July 18, 2012 Author Report 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! Quote Link to post Share on other sites
Antonio Conte 426 Posted July 18, 2012 Report Share Posted July 18, 2012 Constants > Values. Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.