The only error level in PHP that will halt the script but can be caught and dealt with have to be triggered with the trigger_error() function correct? I'm referring to the "E_USER_ERROR" error level. The "E_ERROR" error will simply halt the script and I can't do anything about it as the developer.
You can create your own error handling and halt the script and actually do anything you want when an error occurs.
E_ERROR will simply stop the script. It's meant to be used for:
Fatal run-time errors. These indicate errors that can not be recovered from, such as a memory allocation problem. Execution of the script is halted.
You cannot handle the following other error types for similar reasons:
- E_PARSE
- E_CORE_ERROR
- E_CORE_WARNING
- E_COMPILE_ERROR
- E_COMPILE_WARNING
set_error_handler() however can handle the follow errors:
- E_WARNING
- E_NOTICE
- E_USER_ERROR (using trigger_error)
- E_USER_WARNING (using trigger_error)
- E_USER_NOTICE (using trigger_error)
- E_STRICT
- E_RECOVERABLE_ERROR
Not really sure what your driving at or trying to do here, but if you're looking for a way to "catch" and deal with 'errors' - Maybe look into exceptions.
From PHP Manual on Exceptions
An exception can be thrown, and caught ("catched") within PHP. Code may be surrounded in a try block, to facilitate the catching of potential exceptions. Each try must have at least one corresponding catch block. Multiple catch blocks can be used to catch different classes of exeptions. Normal execution (when no exception is thrown within the try block, or when a catch matching the thrown exception's class is not present) will continue after that last catch block defined in sequence. Exceptions can be thrown (or re-thrown) within a catch block.