protected function overrideNativeFuncs()
    {
        if (Daemon::supported(Daemon::SUPPORT_RUNKIT_INTERNAL_MODIFY)) {
            function define($k, $v)
            {
                if (defined($k)) {
                    runkit_constant_redefine($k, $v);
                } else {
                    runkit_constant_add($k, $v);
                }
            }

            $this->override('define', 'define');

            function header(...$args)
            {
                if (!Daemon::$context instanceof \PHPDaemon\Request\Generic) {
                    return false;
                }
                return Daemon::$context->header(...$args);
            }

            $this->override('header', 'header');

            function isUploadedFile(...$args)
            {
                if (!Daemon::$context instanceof \PHPDaemon\Request\Generic) {
                    return false;
                }
                return Daemon::$context->isUploadedFile(...$args);
            }

            $this->override('isUploadedFile', 'is_uploaded_file');

            function moveUploadedFile(...$args)
            {
                if (!Daemon::$context instanceof \PHPDaemon\Request\Generic) {
                    return false;
                }
                return Daemon::$context->moveUploadedFile(...$args);
            }

            $this->override('moveUploadedFile', 'move_uploaded_file');

            function headersSent(&$file = null, &$line = null)
            {
                if (!Daemon::$context instanceof \PHPDaemon\Request\Generic) {
                    return false;
                }
                return Daemon::$context->headers_sent($file, $line);
            }

            //$this->override('headersSent', 'headers_sent); // Commented out due to a runkit bug

            function headersList()
            {
                if (!Daemon::$context instanceof \PHPDaemon\Request\Generic) {
                    return false;
                }
                return Daemon::$context->headers_list();
            }

            $this->override('headersList', 'headers_list');

            function setcookie(...$args)
            {
                if (!Daemon::$context instanceof \PHPDaemon\Request\Generic) {
                    return false;
                }
                return Daemon::$context->setcookie(...$args);
            }

            $this->override('setcookie', 'setcookie');

            /**
             * @param callable $cb
             */
            function registerShutdownFunction($cb)
            {
                if (!Daemon::$context instanceof \PHPDaemon\Request\Generic) {
                    return false;
                }
                return Daemon::$context->registerShutdownFunction($cb);
            }

            $this->override('registerShutdownFunction', 'register_shutdown_function');

            runkit_function_copy('create_function', 'create_function_native');
            runkit_function_redefine('create_function', '$arg,$body',
                'return \PHPDaemon\Core\Daemon::$process->createFunction($arg,$body);');
        }
    }