Skip to content

Commit cb4aecb

Browse files
committed
ext/pdo: Refactor pdo_stmt_construct() to use newer FCI/FCC API
1 parent e72b6f4 commit cb4aecb

File tree

1 file changed

+4
-27
lines changed

1 file changed

+4
-27
lines changed

ext/pdo/pdo_dbh.c

Lines changed: 4 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,7 @@ static zval *pdo_stmt_instantiate(pdo_dbh_t *dbh, zval *object, zend_class_entry
455455
return object;
456456
} /* }}} */
457457

458-
static void pdo_stmt_construct(zend_execute_data *execute_data, pdo_stmt_t *stmt, zval *object, zend_class_entry *dbstmt_ce, zval *ctor_args) /* {{{ */
458+
static void pdo_stmt_construct(pdo_stmt_t *stmt, zval *object, zend_class_entry *dbstmt_ce, HashTable *ctor_args)
459459
{
460460
zval query_string;
461461
zend_string *key;
@@ -466,32 +466,9 @@ static void pdo_stmt_construct(zend_execute_data *execute_data, pdo_stmt_t *stmt
466466
zend_string_release_ex(key, 0);
467467

468468
if (dbstmt_ce->constructor) {
469-
zend_fcall_info fci;
470-
zend_fcall_info_cache fcc;
471-
zval retval;
472-
473-
fci.size = sizeof(zend_fcall_info);
474-
ZVAL_UNDEF(&fci.function_name);
475-
fci.object = Z_OBJ_P(object);
476-
fci.retval = &retval;
477-
fci.param_count = 0;
478-
fci.params = NULL;
479-
fci.named_params = NULL;
480-
481-
zend_fcall_info_args(&fci, ctor_args);
482-
483-
fcc.function_handler = dbstmt_ce->constructor;
484-
fcc.called_scope = Z_OBJCE_P(object);
485-
fcc.object = Z_OBJ_P(object);
486-
487-
if (zend_call_function(&fci, &fcc) != FAILURE) {
488-
zval_ptr_dtor(&retval);
489-
}
490-
491-
zend_fcall_info_args_clear(&fci, 1);
469+
zend_call_known_function(dbstmt_ce->constructor, Z_OBJ_P(object), Z_OBJCE_P(object), NULL, 0, NULL, ctor_args);
492470
}
493471
}
494-
/* }}} */
495472

496473
/* {{{ Prepares a statement for execution and returns a statement object */
497474
PHP_METHOD(PDO, prepare)
@@ -572,7 +549,7 @@ PHP_METHOD(PDO, prepare)
572549
ZVAL_UNDEF(&stmt->lazy_object_ref);
573550

574551
if (dbh->methods->preparer(dbh, statement, stmt, options)) {
575-
pdo_stmt_construct(execute_data, stmt, return_value, dbstmt_ce, &ctor_args);
552+
pdo_stmt_construct(stmt, return_value, dbstmt_ce, Z_ARRVAL(ctor_args));
576553
return;
577554
}
578555

@@ -1141,7 +1118,7 @@ PHP_METHOD(PDO, query)
11411118
stmt->executed = 1;
11421119
}
11431120
if (ret) {
1144-
pdo_stmt_construct(execute_data, stmt, return_value, dbh->def_stmt_ce, &dbh->def_stmt_ctor_args);
1121+
pdo_stmt_construct(stmt, return_value, dbh->def_stmt_ce, Z_ARRVAL(dbh->def_stmt_ctor_args));
11451122
return;
11461123
}
11471124
}

0 commit comments

Comments
 (0)