Skip to content

Commit bef80e5

Browse files
committed
Drop TODOs or handle exception
1 parent fff1bf8 commit bef80e5

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

Zend/zend_operators.c

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -837,8 +837,6 @@ ZEND_API zend_long ZEND_FASTCALL zval_get_long_func(zval *op, bool is_strict) /*
837837
if (UNEXPECTED(is_strict)) {
838838
if (!zend_is_long_compatible(dval, lval)) {
839839
zend_incompatible_double_to_long_error(dval);
840-
// TODO Need to handle this here?
841-
//if (UNEXPECTED(EG(exception))) {}
842840
}
843841
}
844842
return lval;
@@ -863,8 +861,6 @@ ZEND_API zend_long ZEND_FASTCALL zval_get_long_func(zval *op, bool is_strict) /*
863861
if (UNEXPECTED(is_strict)) {
864862
if (!zend_is_long_compatible(dval, lval)) {
865863
zend_incompatible_string_to_long_error(Z_STR_P(op));
866-
// TODO Need to handle this here?
867-
//if (UNEXPECTED(EG(exception))) {}
868864
}
869865
}
870866
return lval;
@@ -1499,10 +1495,17 @@ ZEND_API zend_result ZEND_FASTCALL bitwise_not_function(zval *result, zval *op1)
14991495
case IS_LONG:
15001496
ZVAL_LONG(result, ~Z_LVAL_P(op1));
15011497
return SUCCESS;
1502-
case IS_DOUBLE:
1503-
// TODO Handle manually in case deprecation notice promoted to Exception?
1504-
ZVAL_LONG(result, ~zend_dval_to_lval_safe(Z_DVAL_P(op1)));
1498+
case IS_DOUBLE: {
1499+
zend_long lval = zend_dval_to_lval(Z_DVAL_P(op1));
1500+
if (!zend_is_long_compatible(Z_DVAL_P(op1), lval)) {
1501+
zend_incompatible_double_to_long_error(Z_DVAL_P(op1));
1502+
if (EG(exception)) {
1503+
return FAILURE;
1504+
}
1505+
}
1506+
ZVAL_LONG(result, ~lval);
15051507
return SUCCESS;
1508+
}
15061509
case IS_STRING: {
15071510
size_t i;
15081511

0 commit comments

Comments
 (0)