2

I have created php extension in c++.In version php 5.6 can able to get currently executed function details. I was getting the arguments value as follows,

if (real_execute_data->function_state.arguments)
    {
        void **p = real_execute_data->function_state.arguments;
        int arg_count = (int)(zend_uintptr_t)* p;

        zval *argument_element;
        for (i = 0; i < arg_count; i++)
        {
            argument_element = (zval*)*(p - (arg_count - i));
            // here can reads the value from argument_element 
        }
    }

In version Php 7.2,I can't find the function_state structure inside of Zend_execute_data.I tried with _zend_arg_info structure, it gives function argument variable names,not the values. How can i get the function arguments value in php 7 above?

1

1 Answer 1

0

Yes. I got it. We can get the function arguments in php 7 and above as follows(zend_execute_data *real_execute_data),

 int arg_count = ZEND_CALL_NUM_ARGS(real_execute_data);
    int i;
    for (i = 1; i <= arg_count; i++)
    {
        zval *argument_element = ZEND_CALL_ARG(real_execute_data, i);
        // we can reads the argument value from "argument_element".
    }
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.