Skip to content

Commit 0038db2

Browse files
committed
Avoid duplicate "non well-formed" warning
The arginfo checking code for internal functions should not generate this warning, as it will be thrown by zpp.
1 parent d5f42d6 commit 0038db2

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

Zend/zend_execute.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -865,10 +865,27 @@ static zend_bool zend_verify_weak_scalar_type_hint_no_sideeffect(zend_uchar type
865865
}
866866
case IS_LONG: {
867867
zend_long dest;
868+
if (Z_TYPE_P(arg) == IS_STRING) {
869+
/* Handle this case separately to avoid the "non well-formed" warning */
870+
double dval;
871+
zend_uchar type = is_numeric_string(Z_STRVAL_P(arg), Z_STRLEN_P(arg), NULL, &dval, 1);
872+
if (type == IS_LONG) {
873+
return 1;
874+
}
875+
if (type == IS_DOUBLE) {
876+
return !zend_isnan(dval) && ZEND_DOUBLE_FITS_LONG(dval);
877+
878+
}
879+
return 0;
880+
}
868881
return zend_parse_arg_long_weak(arg, &dest);
869882
}
870883
case IS_DOUBLE: {
871884
double dest;
885+
if (Z_TYPE_P(arg) == IS_STRING) {
886+
/* Handle this case separately to avoid the "non well-formed" warning */
887+
return is_numeric_string(Z_STRVAL_P(arg), Z_STRLEN_P(arg), NULL, NULL, 1) != 0;
888+
}
872889
return zend_parse_arg_double_weak(arg, &dest);
873890
}
874891
case IS_STRING:

0 commit comments

Comments
 (0)