Skip to content

Commit b52a903

Browse files
committed
Use ZEND_FCI_INITIALIZED() macro to check if an FCI is initialized
1 parent 6ef58da commit b52a903

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

Zend/zend_execute_API.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -819,7 +819,7 @@ zend_result zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_
819819
return SUCCESS; /* we would result in an unstable executor otherwise */
820820
}
821821

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

824824
if (!fci_cache || !fci_cache->function_handler) {
825825
char *error = NULL;

ext/pdo/pdo_stmt.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -684,8 +684,7 @@ static bool do_fetch_func_prepare(pdo_stmt_t *stmt) /* {{{ */
684684

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

697+
/* Invalidate FCI */
698698
stmt->fetch.cls.fci.size = 0;
699699
if (!Z_ISUNDEF(stmt->fetch.cls.ctor_args) && free_ctor_agrs) {
700700
zval_ptr_dtor(&stmt->fetch.cls.ctor_args);
@@ -833,7 +833,7 @@ static bool do_fetch(pdo_stmt_t *stmt, zval *return_value, enum pdo_fetch_type h
833833
if (UNEXPECTED(object_init_ex(return_value, ce) != SUCCESS)) {
834834
return 0;
835835
}
836-
if (!stmt->fetch.cls.fci.size) {
836+
if (!ZEND_FCI_INITIALIZED(stmt->fetch.cls.fci)) {
837837
if (!do_fetch_class_prepare(stmt)) {
838838
zval_ptr_dtor(return_value);
839839
return 0;
@@ -879,7 +879,7 @@ static bool do_fetch(pdo_stmt_t *stmt, zval *return_value, enum pdo_fetch_type h
879879
pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "No fetch function specified");
880880
return 0;
881881
}
882-
if (!stmt->fetch.func.fci.size) {
882+
if (!ZEND_FCI_INITIALIZED(stmt->fetch.func.fci)) {
883883
if (!do_fetch_func_prepare(stmt))
884884
{
885885
return 0;

0 commit comments

Comments
 (0)