Skip to content

Commit 4f8d107

Browse files
committed
Use zend_call_known_function() in ext-pgsql instead of building FCI/FCC
1 parent 4c4e72f commit 4f8d107

File tree

1 file changed

+2
-20
lines changed

1 file changed

+2
-20
lines changed

ext/pgsql/pgsql.c

+2-20
Original file line numberDiff line numberDiff line change
@@ -1833,9 +1833,6 @@ static void php_pgsql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, zend_long result_
18331833

18341834
if (into_object) {
18351835
zval dataset;
1836-
zend_fcall_info fci;
1837-
zend_fcall_info_cache fcc;
1838-
zval retval;
18391836

18401837
ZVAL_COPY_VALUE(&dataset, return_value);
18411838
object_init_ex(return_value, ce);
@@ -1847,23 +1844,8 @@ static void php_pgsql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, zend_long result_
18471844
}
18481845

18491846
if (ce->constructor) {
1850-
fci.size = sizeof(fci);
1851-
ZVAL_UNDEF(&fci.function_name);
1852-
fci.object = Z_OBJ_P(return_value);
1853-
fci.retval = &retval;
1854-
fci.params = NULL;
1855-
fci.param_count = 0;
1856-
fci.named_params = ctor_params;
1857-
1858-
fcc.function_handler = ce->constructor;
1859-
fcc.called_scope = Z_OBJCE_P(return_value);
1860-
fcc.object = Z_OBJ_P(return_value);
1861-
1862-
if (zend_call_function(&fci, &fcc) == FAILURE) {
1863-
zend_throw_exception_ex(zend_ce_exception, 0, "Could not execute %s::%s()", ZSTR_VAL(ce->name), ZSTR_VAL(ce->constructor->common.function_name));
1864-
} else {
1865-
zval_ptr_dtor(&retval);
1866-
}
1847+
zend_call_known_function(ce->constructor, Z_OBJ_P(return_value), Z_OBJCE_P(return_value),
1848+
/* retval */ NULL, /* argc */ 0, /* params */ NULL, ctor_params);
18671849
} else if (ctor_params && zend_hash_num_elements(ctor_params) > 0) {
18681850
/* TODO Convert this to a ValueError */
18691851
zend_argument_error(zend_ce_exception, 3,

0 commit comments

Comments
 (0)