Search the Community
Showing results for tags 'error handling'.
-
Operating System: Windows 7 Server: Apache 2.4.7 / XAMPP 1.8.3 PHP Version 5.5.6 Browsers: Google Chrome Version 33.0.1750.117; Firefox 26.0 Chapter 8 - Error Handling and Debugging: Creating Custom Error Handlers (p. 253-257) I created the error handler as indicated in the book. When tested on browsers the result I get are empty arrays after the error message. I also used the original code downloaded from the text's downloadable content resource and got the same empty arrays. Is this what I should expect? The only difference I see from the book example is the MAC operating system. When I change the value of the 'LIVE' constant to TRUE, I get the correct display of apology message with hidden detailed errors, exactly as in the book. Below is the message with empty arrays when 'LIVE' constant is set to FALSE: Testing Error Reporting An error has occured in script 'C:\Users\file\handle_errors.php' on line 51: Undefined variable: var Array ( [_GET] => Array ( ) [_POST] => Array ( ) [_COOKIE] => Array ( ) [_FILES] => Array ( ) )
-
I've been working through the book and really enjoying it. I'm thrown by the Contact Form example in the Ajax chapter. What it seems to be doing seems stupid, so I'm wondering whether I'm misunderstanding. The handleAjaxRequest function is defined on p. 458. It seems to specify that in case of an error, we submit the form again. The anonymous function that is called if the user clicks the submit button is defined on p. 459. It sends the Ajax request to the server. So if something goes wrong, we just try again? I thought perhaps we would send the form in a non-Ajaxy way, or something? Regards, Rick
-
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.
- 3 replies
-
- error handling
- e_strict
-
(and 1 more)
Tagged with: