Skip to content

Commit 0d3f9ce

Browse files
committed
Zend: Get rid of goto in define()
1 parent f765c36 commit 0d3f9ce

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

Zend/zend_builtin_functions.c

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -575,20 +575,16 @@ ZEND_FUNCTION(define)
575575
zend_error(E_WARNING, "define(): Argument #3 ($case_insensitive) is ignored since declaration of case-insensitive constants is no longer supported");
576576
}
577577

578-
if (Z_TYPE_P(val) == IS_ARRAY) {
579-
if (Z_REFCOUNTED_P(val)) {
580-
if (!validate_constant_array_argument(Z_ARRVAL_P(val), 2)) {
581-
RETURN_THROWS();
582-
} else {
583-
copy_constant_array(&c.value, val);
584-
goto register_constant;
585-
}
578+
if (Z_TYPE_P(val) == IS_ARRAY && Z_REFCOUNTED_P(val)) {
579+
if (!validate_constant_array_argument(Z_ARRVAL_P(val), 2)) {
580+
RETURN_THROWS();
581+
} else {
582+
copy_constant_array(&c.value, val);
586583
}
584+
} else {
585+
ZVAL_COPY(&c.value, val);
587586
}
588587

589-
ZVAL_COPY(&c.value, val);
590-
591-
register_constant:
592588
/* non persistent */
593589
ZEND_CONSTANT_SET_FLAGS(&c, 0, PHP_USER_CONSTANT);
594590
c.name = zend_string_copy(name);

0 commit comments

Comments
 (0)