Hudzilla.org - the homepage of Paul Hudson
Contents > Writing PHP > Troubleshooting Wish List | Report Bug | About Me ]

19.12.1     Error types

This is NOT the latest copy of this book; click here for the latest version.

PHP has a number of possible errors that it might return, all of which mean something different and are treated differently. Here is the complete list:

E_ERROR

Fatal run-time error. Script execution is terminated because the error cannot be recovered from.

E_WARNING

Run-time warning. Execution of the script is not terminated because the situation can be recovered from.

E_PARSE

Compile-time parse errors. Only generated by the PHP parser.

E_NOTICE

Run-time notice. Execution of the script is not terminated, but it is possible there is an error in your code.

E_CORE_ERROR

Fatal error in PHP's internals. Indicates a serious problem with your PHP installation.

E_CORE_WARNING

Compile-time warning. Generally indicates a problem with your PHP installation.

E_COMPILE_ERROR

Fatal compile-time error. This indicates a syntax error in your script that could not be recovered from.

E_COMPILE_WARNING

This indicates a non-fatal syntax error in your script

E_USER_ERROR

User-generated error message. This is generated from inside PHP scripts to halt execution with an appropriate message.

E_USER_WARNING

User-generated warning message. This is generated from inside PHP scripts to flag up a serious warning message without halting execution.

E_USER_NOTICE

User-generated notice message. This is generated from inside PHP scripts to print a minor notice to the screen, usually regarding potential problems with scripts.

E_ALL

This is a catch-all error type, which means "all errors combined".

All warnings and notices can usually be recovered from without too much problem, however errors are critical and usually mean "you would not want to recover from this".

User errors, user warnings, and user notices are all generated using the trigger_error() function, and you should use them in your own code to handle possible errors that others (or indeed you) might make when calling your own functions.

Notices are generally very minor things - using an uninitialised variable, for example - that may be a sign that you have got a hidden bug lurking in there, but it may also be there by design, as notices are generally quite strict.





<< 19.12 Troubleshooting   19.12.2 Choosing what types of errors you see: error_reporting() >>
Table of Contents
Want to see this stuff in print? PHP in a Nutshell takes the core topics covered here, adds in thousands of edits from the editorial team and myself, and combines them to make an unbeatable reference for PHP programmers at all levels.



My latest book has hundreds more tips on how to use PHP, Apache, and MySQL, plus Perl, Python, shell scripts, performance tuning, and more!



Top-right shadow
 
Bottom-left shadow Bottom shadow

Comments from other readers
Be the first to add a comment to this chapter!



Add comment
Please note that by posting a comment here you are committing it to the public domain. This is important so that others can make use of your code themselves, and also so that I can incorporate helpful notes directly into the main text. Comments are limited to 2000 characters in length.

If you are reporting an error in the content, please tell me directly.

Your name/email address:
Your comment:
 
Now, in order to verify that you're a real person, please answer this simple question: what is seven plus four?
The answer is:
(please write in
numbers, eg 19)


Top-right shadow
 
Bottom-left shadow Bottom shadow