Skip to content

Commit 552b1ee

Browse files
committed
feedback
1 parent 9273480 commit 552b1ee

1 file changed

Lines changed: 9 additions & 7 deletions

File tree

Zend/zend_operators.c

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1082,6 +1082,7 @@ ZEND_API double ZEND_FASTCALL zval_try_get_double_func(const zval *op, bool *fai
10821082
uint8_t type;
10831083
zend_long lval;
10841084
double dval;
1085+
double result;
10851086
bool trailing_data = false;
10861087

10871088
type = is_numeric_string_ex(Z_STRVAL_P(op), Z_STRLEN_P(op), &lval, &dval,
@@ -1090,20 +1091,21 @@ ZEND_API double ZEND_FASTCALL zval_try_get_double_func(const zval *op, bool *fai
10901091
*failed = true;
10911092
return 0.0;
10921093
}
1094+
if (type == IS_DOUBLE) {
1095+
result = dval;
1096+
} else if (UNEXPECTED(lval == 0)) {
1097+
result = zend_strtod(Z_STRVAL_P(op), NULL);
1098+
} else {
1099+
result = (double) lval;
1100+
}
10931101
if (UNEXPECTED(trailing_data)) {
10941102
zend_error(E_WARNING, "A non-numeric value encountered");
10951103
if (UNEXPECTED(EG(exception))) {
10961104
*failed = true;
10971105
return 0.0;
10981106
}
10991107
}
1100-
if (type == IS_DOUBLE) {
1101-
return dval;
1102-
}
1103-
if (UNEXPECTED(lval == 0)) {
1104-
return zend_strtod(Z_STRVAL_P(op), NULL);
1105-
}
1106-
return (double) lval;
1108+
return result;
11071109
}
11081110
case IS_OBJECT:
11091111
{

0 commit comments

Comments
 (0)