src/Workers/ForkingWorker.php
private function readErrorFromSocket($socket): ?string
    {
        $error = '';
        while (!empty($res = socket_read($socket, 8192))) {
            $error .= $res;
        }

        $error = unserialize($error);

        if (is_array($error)) {
            $handler = new ErrorFormatter();

            return sprintf(
                '%s: %s in %s on line %d',
                $handler->constant($error['type']) ?: 'Unknown',
                $error['message'],
                $error['file'],
                $error['line']
            );
        }

        return null;
    }
private function readErrorFromSocket($socket): ?string
    {
        $error = '';
        while (!empty($res = socket_read($socket, 8192))) {
            $error .= $res;
        }

        $error = unserialize($error);

        if (is_array($error)) {
            $handler = new ErrorFormatter();

            return sprintf(
                '%s: %s in %s on line %d',
                $handler->constant($error['type']) ?: 'Unknown',
                $error['message'],
                $error['file'],
                $error['line']
            );
        }

        return null;
    }
Tries to create an error message from the socket.

@param  resource $socket
@return null|string