set_error_handler

Supported Versions: PHP 4 >= 4.0.1, PHP 5, PHP 7, PHP 8
Sets a user-defined error handler function
set_error_handler(?callable $callbackint $error_levels E_ALL): ?callable
    public function cloneVar($varint $filter 0)

    {

        
$this->prevErrorHandler set_error_handler(function ($type$msg$file$line$context = []) {

            if (
\E_RECOVERABLE_ERROR === $type || \E_USER_ERROR === $type) {


                throw new 
\ErrorException($msg0$type$file$line);

            }



            if (
$this->prevErrorHandler) {

                return (
$this->prevErrorHandler)($type$msg$file$line$context);

            }



            return 
false;

        });

        
$this->filter $filter;



        if (
$gc gc_enabled()) {
        $context array_filter($context);

        
$encodedPayload base64_encode(serialize([$data$context]))."\n";



        
set_error_handler([self::class, 'nullErrorHandler']);

        try {

            if (-
!== stream_socket_sendto($this->socket$encodedPayload)) {

                return 
true;
    private function createSocket()

    {

        
set_error_handler([self::class, 'nullErrorHandler']);

        try {

            return 
stream_socket_client($this->host$errno$errstr3\STREAM_CLIENT_CONNECT \STREAM_CLIENT_ASYNC_CONNECT);

        } finally {