Fonksiyon restore_exception_handler
restore_exception_handler fonksiyonu, set_exception_handler ile değiştirilmiş olan önceki istisna işleyicisini geri yükler.
Bu fonksiyon parametre almaz ve değer döndürmez.
Sözdizimi
restore_exception_handler();
Örnek
Bir özel istisna işleyici ayarlayalım ve ardından öncekini geri yükleyelim:
<?php
function customExceptionHandler($exception) {
echo 'Özel işleyici: ' . $exception->getMessage();
}
set_exception_handler('customExceptionHandler');
restore_exception_handler();
?>
Örnek
Geri yüklemeden sonra standart mekanizmanın çalıştığını kontrol edelim:
<?php
set_exception_handler(function($exception) {
echo 'İşleyici 1: ' . $exception->getMessage();
});
set_exception_handler(function($exception) {
echo 'İşleyici 2: ' . $exception->getMessage();
});
restore_exception_handler();
throw new Exception('Test hatası');
?>
Kodun çalıştırılmasının sonucu:
'İşleyici 1: Test hatası'