Skip to content

Commit 995f2cc

Browse files
committed
Extract duplicate warning check
1 parent 389c12d commit 995f2cc

File tree

1 file changed

+7
-12
lines changed

1 file changed

+7
-12
lines changed

Zend/zend_operators.c

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -309,21 +309,16 @@ static zend_never_inline zend_long ZEND_FASTCALL zendi_try_get_long(zval *op, ze
309309
if (type == 0) {
310310
*failed = 1;
311311
return 0;
312-
} else if (EXPECTED(type == IS_LONG)) {
313-
if (UNEXPECTED(trailing_data)) {
314-
zend_error(E_WARNING, "A non-numeric value encountered");
315-
if (UNEXPECTED(EG(exception))) {
316-
*failed = 1;
317-
}
312+
}
313+
if (UNEXPECTED(trailing_data)) {
314+
zend_error(E_WARNING, "A non-numeric value encountered");
315+
if (UNEXPECTED(EG(exception))) {
316+
*failed = 1;
318317
}
318+
}
319+
if (EXPECTED(type == IS_LONG)) {
319320
return lval;
320321
} else {
321-
if (trailing_data) {
322-
zend_error(E_WARNING, "A non-numeric value encountered");
323-
if (UNEXPECTED(EG(exception))) {
324-
*failed = 1;
325-
}
326-
}
327322
/* Previously we used strtol here, not is_numeric_string,
328323
* and strtol gives you LONG_MAX/_MIN on overflow.
329324
* We use use saturating conversion to emulate strtol()'s

0 commit comments

Comments
 (0)