I'm trying to pass multiple parameters (type ZVAL) by reference in a php extension function. But I'm not getting the changed value. I followed the suggestions from the following post. Passing a variable by reference into a PHP7 extension
But it worked for only one argument. Below is the code in which I'm trying to pass 2 ZVALs
PHP_FUNCTION(sample_byref_compiletime)
{
zval *a,*b;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC,
"z/z/", &a, &b ) == FAILURE)
{
php_printf("Error");
RETURN_NULL();
}
ZVAL_DEREF(a);
SEPARATE_ZVAL_NOREF(a);
zval_dtor(a);
ZVAL_LONG(a, 40);
ZVAL_DEREF(b);
SEPARATE_ZVAL_NOREF(b);
zval_dtor(b);
ZVAL_LONG(b, 41);
}