restore_error_handler()

restore_error_handler() — Restores the previous error handler function.

Built-in function of PHP 8.5. The manual lists it as available in PHP 4 >= 4.0.1, PHP 5, PHP 7, PHP 8. This page is the reference card: signature, parameters and return value, plus the changelog and the example the manual provides.

What it does

Pops the error handler that was active before the most recent call to set_error_handler() off the internal stack of error handlers and makes it active again, together with the error_levels mask it was registered with. The restored handler could be the built-in or a user defined function.

Signature

restore_error_handler(): true

Parameters

This function takes no parameters.

Return value

Always returns true.

Example

A runnable snippet:

function unserialize_handler($errno, $errstr) { echo "Invalid serialized value.\n"; } $serialized = 'foo'; set_error_handler('unserialize_handler'); $original = unserialize($serialized); restore_error_handler();

Output:

Invalid serialized value.

See also

error_reporting(), set_error_handler(), get_error_handler(), restore_exception_handler(), trigger_error()

All PHP 8.5 built-in functions

Reference card built from the PHP manual page restore_error_handler() (PHP documentation, CC BY 3.0). The page is generated from the manual, so the wording of the parameter and return value text follows php.net.