Callback functions in php and exceptions

I am currently reading a php manual about callback functions and found an interesting note:

Callbacks registered with functions such as call_user_func () and call_user_func_array () will not be called if there is an uncaught exception in the previous callback.

Obviously, the script will be aborted in the event of an uncaught exception. So, why do the authors of the php manual additionally write about call_user_func? Or did I misunderstand this expression?

+4
source share
1 answer

This reminds me more of a reminder than part of a document. All uncaught exceptions are fatal in php, unless they talked about calling call_user_func (), even if you installed a handler (with set_exception_handler) instead of a catch that sounds like something the lawyer will do.

+1
source

Source: https://habr.com/ru/post/1441127/


All Articles