zend_call_method with arguments passed by reference
| From: | mdolezal.noctuint.cz via internals | Date: | Wed, 08 Jan 2020 14:59:28 +0000 |
| Subject: | zend_call_method with arguments passed by reference | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-108035@lists.php.net to get a copy of this message | ||
Hello,
I hope this is the appropriate mailing list, please redirect me to better
please if required.
I am currently rewriting our PHP extension from PHP5 to PHP7.
To call PHP methods from our C/C++ code we use slightly modified
zend_call_method from Zend/zend_interfaces.c (to use more arguments than 2).
Now I found out that it does not work with arguments passed by reference,
such as:
public function FuncWithRef(array &$changeThis)
if values are changed in the PHP code then zval values back in C part after
zend_call_function call are not influenced.
With PHP5 the value was overwritten and could be used later in C code.
Previously the zend_fcall_info struct for function call was filled with
params simply by
params[0] = &arg1;
In PHP7 this is changed to
ZVAL_COPY_VALUE(¶ms[0], arg1);
After function is executed (zend_call_function) both fci.params and arg1
contain still the original zval values,
changes made in PHP code are not available. Is there any way how to solve
this?
I am mainly searching for and comparing code snippets in PHP/ext folder to
see how things were rewritten from PHP5 to PHP7.
Sorry if I missed something obvious and thank you for your help.