restore_error_handler

(PHP 4 >= 4.0.1, PHP 5, PHP 7)
Restores the previous error handler function
bool restore_error_handler ( void )

Used after changing the error handler function using set_error_handler(), to revert to the previous error handler (which could be the built-in or a user defined function).

Returns:

This function always returns TRUE.

Examples:
restore_error_handler() example

Decide if unserialize() caused an error, then restore the original error handler.

1
2
3
4
5
6
7
8
9
10
11
<?php
function unserialize_handler($errno$errstr)
{
    echo "Invalid serialized value.\n";
}
 
$serialized 'foo';
set_error_handler('unserialize_handler');
$original = unserialize($serialized);
restore_error_handler();
?>

The above example will output:

Invalid serialized value.
See also:

error_reporting() -

set_error_handler() -

restore_exception_handler() -

trigger_error() -

doc_php
2025-01-10 15:47:30
Comments
Leave a Comment

Please login to continue.