Skip to content

Commit 710eb4c

Browse files
committed
Change this to an early return
Avoid deep indentation.
1 parent f1fc6bb commit 710eb4c

1 file changed

Lines changed: 18 additions & 17 deletions

File tree

Zend/zend_exceptions.c

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -541,26 +541,27 @@ static void build_trace_args(zval *arg, smart_str *str) /* {{{ */
541541

542542
static void build_trace_args_list(zval *tmp, smart_str *str) /* {{{ */
543543
{
544-
if (EXPECTED(Z_TYPE_P(tmp) == IS_ARRAY)) {
545-
zend_string *name;
546-
zval *arg;
547-
HashTable *ht = Z_ARRVAL_P(tmp);
548-
uint32_t index = 0;
549-
550-
ZEND_HASH_FOREACH_STR_KEY_VAL(ht, name, arg) {
551-
if (name) {
552-
smart_str_append(str, name);
553-
smart_str_appends(str, ": ");
554-
}
555-
build_trace_args(arg, str);
556-
if (++index != zend_hash_num_elements(ht)) {
557-
smart_str_appends(str, ", ");
558-
}
559-
} ZEND_HASH_FOREACH_END();
560-
} else {
544+
if (EXPECTED(Z_TYPE_P(tmp) != IS_ARRAY)) {
561545
/* only happens w/ reflection abuse (Zend/tests/bug63762.phpt) */
562546
zend_error(E_WARNING, "args element is not an array");
547+
return;
563548
}
549+
550+
zend_string *name;
551+
zval *arg;
552+
HashTable *ht = Z_ARRVAL_P(tmp);
553+
uint32_t index = 0;
554+
555+
ZEND_HASH_FOREACH_STR_KEY_VAL(ht, name, arg) {
556+
if (name) {
557+
smart_str_append(str, name);
558+
smart_str_appends(str, ": ");
559+
}
560+
build_trace_args(arg, str);
561+
if (++index != zend_hash_num_elements(ht)) {
562+
smart_str_appends(str, ", ");
563+
}
564+
} ZEND_HASH_FOREACH_END();
564565
}
565566
/* }}} */
566567

0 commit comments

Comments
 (0)