首页 > 解决方案 > 如何在我自己的扩展中将 file_handle 参数添加到 php 中的 call_user_func_ex?

问题描述

我想在zendaccelerator.c 中使用我自己的函数,但我无法将file_handler 参数传递给call_user_func_ex。请检查我的样品并给我一些建议...

zend_op_array *own_compile_file(zend_file_handle *file_handle, int type TSRMLS_DC) {
    zval *function_name;
    zend_op_array *opcode_array;
    zval *params = { file_handle, TSRMLS_DC };

    TSRMLS_FETCH();

    MAKE_STD_ZVAL(function_name);
    ZVAL_STRINGL(function_name, FUNC_NAME, strlen(FUNC_NAME));

    if (call_user_function_ex(CG(function_table), NULL, function_name,       &opcode_array, 2, params, 0, NULL TSRMLS_CC) != SUCCESS) {
        zend_error(E_ERROR, "Function name compile failed");

        return NULL;
    }

    FREE_ZVAL(function_name);

    return opcode_array;
}

当我在 Centos7 上进行制作时,我收到以下错误消息:警告:从不兼容的指针类型初始化 (zval *params...)

标签: phpc++opcache

解决方案


推荐阅读