Explicitly create references in UConverter callbacks

And don't allow separation.
This commit is contained in:
Nikita Popov 2020-07-07 09:29:21 +02:00
parent 5b4bf4d3e9
commit e93aca7167

View file

@ -224,11 +224,12 @@ static void php_converter_to_u_callback(const void *context,
ZVAL_EMPTY_STRING(&zargs[2]);
}
ZVAL_LONG(&zargs[3], *pErrorCode);
ZVAL_MAKE_REF(&zargs[3]);
objval->to_cb.param_count = 4;
objval->to_cb.params = zargs;
objval->to_cb.retval = &retval;
objval->to_cb.no_separation = 0;
objval->to_cb.no_separation = 1;
if (zend_call_function(&(objval->to_cb), &(objval->to_cache)) == FAILURE) {
/* Unlikely */
php_converter_throw_failure(objval, U_INTERNAL_PROGRAM_ERROR, "Unexpected failure calling toUCallback()");
@ -306,11 +307,12 @@ static void php_converter_from_u_callback(const void *context,
}
ZVAL_LONG(&zargs[2], codePoint);
ZVAL_LONG(&zargs[3], *pErrorCode);
ZVAL_MAKE_REF(&zargs[3]);
objval->from_cb.param_count = 4;
objval->from_cb.params = zargs;
objval->from_cb.retval = &retval;
objval->from_cb.no_separation = 0;
objval->from_cb.no_separation = 1;
if (zend_call_function(&(objval->from_cb), &(objval->from_cache)) == FAILURE) {
/* Unlikely */
php_converter_throw_failure(objval, U_INTERNAL_PROGRAM_ERROR, "Unexpected failure calling fromUCallback()");