Skip to content

Commit

Permalink
Use ZEND_FCI_INITIALIZED() macro to check if an FCI is initialized
Browse files Browse the repository at this point in the history
  • Loading branch information
Girgias committed Dec 29, 2024
1 parent 6ef58da commit b52a903
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Zend/zend_execute_API.c
Original file line number Diff line number Diff line change
Expand Up @@ -819,7 +819,7 @@ zend_result zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_
return SUCCESS; /* we would result in an unstable executor otherwise */
}

ZEND_ASSERT(fci->size == sizeof(zend_fcall_info));
ZEND_ASSERT(ZEND_FCI_INITIALIZED(*fci));

if (!fci_cache || !fci_cache->function_handler) {
char *error = NULL;
Expand Down
8 changes: 4 additions & 4 deletions ext/pdo/pdo_stmt.c
Original file line number Diff line number Diff line change
Expand Up @@ -684,8 +684,7 @@ static bool do_fetch_func_prepare(pdo_stmt_t *stmt) /* {{{ */

static void do_fetch_opt_finish(pdo_stmt_t *stmt, int free_ctor_agrs) /* {{{ */
{
/* fci.size is used to check if it is valid */
if (stmt->fetch.cls.fci.size && stmt->fetch.cls.fci.params) {
if (ZEND_FCI_INITIALIZED(stmt->fetch.cls.fci) && stmt->fetch.cls.fci.params) {
if (!Z_ISUNDEF(stmt->fetch.cls.ctor_args)) {
/* Added to free constructor arguments */
zend_fcall_info_args_clear(&stmt->fetch.cls.fci, 1);
Expand All @@ -695,6 +694,7 @@ static void do_fetch_opt_finish(pdo_stmt_t *stmt, int free_ctor_agrs) /* {{{ */
stmt->fetch.cls.fci.params = NULL;
}

/* Invalidate FCI */
stmt->fetch.cls.fci.size = 0;
if (!Z_ISUNDEF(stmt->fetch.cls.ctor_args) && free_ctor_agrs) {
zval_ptr_dtor(&stmt->fetch.cls.ctor_args);
Expand Down Expand Up @@ -833,7 +833,7 @@ static bool do_fetch(pdo_stmt_t *stmt, zval *return_value, enum pdo_fetch_type h
if (UNEXPECTED(object_init_ex(return_value, ce) != SUCCESS)) {
return 0;
}
if (!stmt->fetch.cls.fci.size) {
if (!ZEND_FCI_INITIALIZED(stmt->fetch.cls.fci)) {
if (!do_fetch_class_prepare(stmt)) {
zval_ptr_dtor(return_value);
return 0;
Expand Down Expand Up @@ -879,7 +879,7 @@ static bool do_fetch(pdo_stmt_t *stmt, zval *return_value, enum pdo_fetch_type h
pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "No fetch function specified");
return 0;
}
if (!stmt->fetch.func.fci.size) {
if (!ZEND_FCI_INITIALIZED(stmt->fetch.func.fci)) {
if (!do_fetch_func_prepare(stmt))
{
return 0;
Expand Down

0 comments on commit b52a903

Please sign in to comment.