Skip to content
Merged
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
42 changes: 17 additions & 25 deletions ext/standard/array.c
Original file line number Diff line number Diff line change
Expand Up @@ -6622,42 +6622,34 @@ static zend_result php_array_find(const HashTable *array, zend_fcall_info fci, z
if (!str_key) {
ZVAL_LONG(&args[1], num_key);
} else {
ZVAL_STR_COPY(&args[1], str_key);
ZVAL_STR(&args[1], str_key);
}

ZVAL_COPY(&args[0], operand);
ZVAL_COPY_VALUE(&args[0], operand);

zend_result result = zend_call_function(&fci, &fci_cache);
if (EXPECTED(result == SUCCESS)) {
int retval_true;
ZEND_ASSERT(result == SUCCESS);

retval_true = zend_is_true(&retval);
zval_ptr_dtor(&retval);

/* This negates the condition, if negate_condition is true. Otherwise it does nothing with `retval_true`. */
retval_true ^= negate_condition;

if (retval_true) {
if (result_value != NULL) {
ZVAL_COPY_DEREF(result_value, &args[0]);
}
if (UNEXPECTED(EG(exception))) {
return FAILURE;
}

if (result_key != NULL) {
ZVAL_COPY(result_key, &args[1]);
}
bool retval_true = zend_is_true(&retval);
zval_ptr_dtor(&retval);

zval_ptr_dtor(&args[0]);
zval_ptr_dtor(&args[1]);
/* This negates the condition, if negate_condition is true. Otherwise it does nothing with `retval_true`. */
retval_true ^= negate_condition;

return SUCCESS;
if (retval_true) {
if (result_value != NULL) {
ZVAL_COPY_DEREF(result_value, &args[0]);
}
}

zval_ptr_dtor(&args[0]);
zval_ptr_dtor(&args[1]);
if (result_key != NULL) {
ZVAL_COPY(result_key, &args[1]);
}

if (UNEXPECTED(result != SUCCESS)) {
return FAILURE;
break;
}
} ZEND_HASH_FOREACH_END();

Expand Down
Loading