Skip to content

Commit e6e2ec5

Browse files
committed
Merge duplicate code blocks
This makes the code less error-prone.
1 parent 783ecad commit e6e2ec5

File tree

1 file changed

+1
-13
lines changed

1 file changed

+1
-13
lines changed

Zend/zend_ini.c

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -696,19 +696,7 @@ static zend_ulong zend_ini_parse_quantity_internal(zend_string *value, zend_ini_
696696
return 0;
697697
}
698698
digits += 2;
699-
if (UNEXPECTED(digits == str_end)) {
700-
/* Escape the string to avoid null bytes and to make non-printable chars
701-
* visible */
702-
smart_str_append_escaped(&invalid, ZSTR_VAL(value), ZSTR_LEN(value));
703-
smart_str_0(&invalid);
704-
705-
*errstr = zend_strpprintf(0, "Invalid quantity \"%s\": no digits after base prefix, interpreting as \"0\" for backwards compatibility",
706-
ZSTR_VAL(invalid.s));
707-
708-
smart_str_free(&invalid);
709-
return 0;
710-
}
711-
if (UNEXPECTED(digits != zend_ini_consume_quantity_prefix(digits, str_end))) {
699+
if (UNEXPECTED(digits == str_end || digits != zend_ini_consume_quantity_prefix(digits, str_end))) {
712700
/* Escape the string to avoid null bytes and to make non-printable chars
713701
* visible */
714702
smart_str_append_escaped(&invalid, ZSTR_VAL(value), ZSTR_LEN(value));

0 commit comments

Comments
 (0)