Skip to content

Commit c0f2727

Browse files
committedOct 31, 2022
Use zend_call_known_function() in ext-mysqli instead of building FCI/FCC
1 parent 4f8d107 commit c0f2727

File tree

1 file changed

+3
-20
lines changed

1 file changed

+3
-20
lines changed
 

‎ext/mysqli/mysqli.c

+3-20
Original file line numberDiff line numberDiff line change
@@ -787,9 +787,7 @@ void php_mysqli_fetch_into_hash(INTERNAL_FUNCTION_PARAMETERS, int override_flags
787787
php_mysqli_fetch_into_hash_aux(return_value, result, fetchtype);
788788

789789
if (into_object && Z_TYPE_P(return_value) == IS_ARRAY) {
790-
zval dataset, retval;
791-
zend_fcall_info fci;
792-
zend_fcall_info_cache fcc;
790+
zval dataset;
793791

794792
ZVAL_COPY_VALUE(&dataset, return_value);
795793

@@ -804,23 +802,8 @@ void php_mysqli_fetch_into_hash(INTERNAL_FUNCTION_PARAMETERS, int override_flags
804802
}
805803

806804
if (ce->constructor) {
807-
fci.size = sizeof(fci);
808-
ZVAL_UNDEF(&fci.function_name);
809-
fci.object = Z_OBJ_P(return_value);
810-
fci.retval = &retval;
811-
fci.params = NULL;
812-
fci.param_count = 0;
813-
fci.named_params = ctor_params;
814-
815-
fcc.function_handler = ce->constructor;
816-
fcc.called_scope = Z_OBJCE_P(return_value);
817-
fcc.object = Z_OBJ_P(return_value);
818-
819-
if (zend_call_function(&fci, &fcc) == FAILURE) {
820-
zend_throw_exception_ex(zend_ce_exception, 0, "Could not execute %s::%s()", ZSTR_VAL(ce->name), ZSTR_VAL(ce->constructor->common.function_name));
821-
} else {
822-
zval_ptr_dtor(&retval);
823-
}
805+
zend_call_known_function(ce->constructor, Z_OBJ_P(return_value), Z_OBJCE_P(return_value),
806+
/* retval */ NULL, /* argc */ 0, /* params */ NULL, ctor_params);
824807
} else if (ctor_params && zend_hash_num_elements(ctor_params) > 0) {
825808
/* TODO Convert this to a ValueError */
826809
zend_argument_error(zend_ce_exception, ERROR_ARG_POS(3),

0 commit comments

Comments
 (0)
Please sign in to comment.