Error Handling
10 entries
assert
Asserts an expectation that should always hold; failure throws AssertionError; only zend.assertions=1 executes it, while -1 (recommended for production) compiles it away at zero cost.
error_clear_last
Clears the record of the most recent error.
error_get_last
Returns the most recent error that occurred (type/message/file/line).
error_log
Log routing: message_type sends to system logger (0) / email (1) / destination file append (3) / SAPI log (4); type=0 always returns true.
error_reporting
Sets which error levels are reported and returns the current level.
restore_error_handler
Removes the current error handler and restores the previous one.
set_error_handler
Registers a custom callback to take over error handling.
set_exception_handler
Installs the fallback handler for uncaught throwables (both Error and Exception implement Throwable); returns the previously installed handler (null if none); the script ends after the callback returns.
Structured Stream Errors
The PHP 8.6 stream error family: the error_mode context option turns stream failures into thrown StreamExceptions or silence — errors become structured objects of StreamErrorCode enum + wrapperName + path, ending the era of the warning string.
trigger_error
Raises a user-level error or warning from user code.