Skip to content

Commit 5491bdd

Browse files
committed
Zend: unify type checking for class constants, properties, arguments, and return values
1 parent f1c7f2d commit 5491bdd

7 files changed

Lines changed: 432 additions & 483 deletions

File tree

‎Zend/zend_API.c‎

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -626,11 +626,7 @@ ZEND_API bool ZEND_FASTCALL zend_parse_arg_long_weak(const zval *arg, zend_long
626626
} else {
627627
zend_long lval = zend_dval_to_lval(Z_DVAL_P(arg));
628628
if (UNEXPECTED(!zend_is_long_compatible(Z_DVAL_P(arg), lval))) {
629-
/* Check arg_num is not (uint32_t)-1, as otherwise its called by
630-
* zend_verify_weak_scalar_type_hint_no_sideeffect() */
631-
if (arg_num != (uint32_t)-1) {
632-
zend_incompatible_double_to_long_error(Z_DVAL_P(arg));
633-
}
629+
zend_incompatible_double_to_long_error(Z_DVAL_P(arg));
634630
if (UNEXPECTED(EG(exception))) {
635631
return 0;
636632
}
@@ -654,11 +650,7 @@ ZEND_API bool ZEND_FASTCALL zend_parse_arg_long_weak(const zval *arg, zend_long
654650
lval = zend_dval_to_lval(d);
655651
/* This only checks for a fractional part as if doesn't fit it already throws a TypeError */
656652
if (UNEXPECTED(!zend_is_long_compatible(d, lval))) {
657-
/* Check arg_num is not (uint32_t)-1, as otherwise its called by
658-
* zend_verify_weak_scalar_type_hint_no_sideeffect() */
659-
if (arg_num != (uint32_t)-1) {
660-
zend_incompatible_string_to_long_error(Z_STR_P(arg));
661-
}
653+
zend_incompatible_string_to_long_error(Z_STR_P(arg));
662654
if (UNEXPECTED(EG(exception))) {
663655
return 0;
664656
}

0 commit comments

Comments
 (0)