I am trying to create a PHP extension for PHP 7.2, I have already managed to create for 5.6 in PHP 7.2 I have made the required changes in the code based on the new Zend API, but now I am stuck in this point, I want to call a php user define function from the extension.
I have tried with the call_user_function_ex function to call my user define function.
zval *function_name, *retval_ptr, *param_file, **params[1];
TSRMLS_FETCH();
ZVAL_STRINGL(function_name, functionRequire,
strlen(functionRequire));
ZVAL_STRINGL(param_file, ranKey,
strlen(ranKey));
params[0] = ¶m_file;
php_printf("%s %s 1st",functionRequire,ranKey);
//RETURN_NULL();
if (call_user_function_ex(CG(function_table), NULL, function_name,
&retval_ptr, 1, params, 0, NULL TSRMLS_CC) != SUCCESS) {
php_printf("%s\n",contactInfo );
zend_error(E_ERROR, "Function call failed ");
RETURN_NULL();
}
php_printf("%s %s 2nd",functionRequire,ranKey);
RETURN_NULL();
FREE_ZVAL(function_nameCh);
FREE_ZVAL(function_name);
FREE_ZVAL(param_file);
I have tried with printing the value after each statement after that I realize that it getting crashed when it tried to call “call_user_function_ex” function. Am I doing anything wrong but the same code is working fine in PHP 5.6
Please Help.