restore_error_handler

(PHP 4 >= 4.0.1, PHP 5, PHP 7, PHP 8)

restore_error_handler以前のエラーハンドラ関数を回復する

説明

restore_error_handler(): true

set_error_handler() を使用してエラーハンドラ関数を 変更した後、元のエラーハンドラ(組込またはユーザー定義関数)に戻すために 使用されます。

パラメータ

この関数にはパラメータはありません。

戻り値

常に true を返します。

例1 restore_error_handler() の例

unserialize() がエラーを発生した場合に 元のエラーハンドラに戻すことにする

<?php
function unserialize_handler($errno, $errstr)
{
echo
"Invalid serialized value.\n";
}

$serialized = 'foo';
set_error_handler('unserialize_handler');
$original = unserialize($serialized);
restore_error_handler();
?>

上の例の出力は以下となります。

Invalid serialized value.

参考

To Top