Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use ZEND_FCI_INITIALIZED() macro to check if an FCI is initialized #17291

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading