Skip to content

Commit 002607d

Browse files
committed
wip
1 parent 5bb74c4 commit 002607d

File tree

4 files changed

+5
-12
lines changed

4 files changed

+5
-12
lines changed

Zend/zend_API.c

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -585,7 +585,6 @@ ZEND_API zend_opt_long ZEND_FASTCALL zend_parse_arg_long_weak(const zval *arg, u
585585
}
586586
}
587587
result.value = lval;
588-
result.has_value = true;
589588
}
590589
} else if (EXPECTED(Z_TYPE_P(arg) == IS_STRING)) {
591590
double d;
@@ -614,27 +613,22 @@ ZEND_API zend_opt_long ZEND_FASTCALL zend_parse_arg_long_weak(const zval *arg, u
614613
}
615614
}
616615
result.value = lval;
617-
result.has_value = true;
618616
} else {
619617
return result;
620618
}
621-
} else {
622-
result.has_value = true;
623619
}
624620
if (UNEXPECTED(EG(exception))) {
625-
result.has_value = false;
626621
return result;
627622
}
628623
} else if (EXPECTED(Z_TYPE_P(arg) < IS_TRUE)) {
629624
if (UNEXPECTED(Z_TYPE_P(arg) == IS_NULL) && !zend_null_arg_deprecated("int", arg_num)) {
630625
return result;
631626
}
632627
result.value = 0;
633-
result.has_value = true;
634628
} else if (EXPECTED(Z_TYPE_P(arg) == IS_TRUE)) {
635629
result.value = 1;
636-
result.has_value = true;
637630
}
631+
result.has_value = true;
638632
return result;
639633
}
640634
/* }}} */

Zend/zend_execute.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -723,14 +723,13 @@ ZEND_API ZEND_COLD void zend_verify_arg_error(
723723

724724
static bool zend_verify_weak_scalar_type_hint(uint32_t type_mask, zval *arg)
725725
{
726-
zend_long lval;
727-
double dval;
728-
729726
/* Type preference order: int -> float -> string -> bool */
730727
if (type_mask & MAY_BE_LONG) {
731728
/* For an int|float union type and string value,
732729
* determine chosen type by is_numeric_string() semantics. */
733730
if ((type_mask & MAY_BE_DOUBLE) && Z_TYPE_P(arg) == IS_STRING) {
731+
zend_long lval;
732+
double dval;
734733
uint8_t type = is_numeric_str_function(Z_STR_P(arg), &lval, &dval);
735734
if (type == IS_LONG) {
736735
zend_string_release(Z_STR_P(arg));

Zend/zend_vm_def.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5507,7 +5507,7 @@ ZEND_VM_C_LABEL(send_array):
55075507
} else if (Z_TYPE_P(op2) == IS_NULL) {
55085508
len = count - skip;
55095509
} else if (EX_USES_STRICT_TYPES()
5510-
|| !(result = zend_parse_arg_long_weak(op2, /* arg_num */ 3)).has_value) {
5510+
|| !(result = zend_parse_arg_long_weak(op2, /* arg_num */ 3)).has_value) {
55115511
zend_type_error(
55125512
"array_slice(): Argument #3 ($length) must be of type ?int, %s given",
55135513
zend_zval_value_name(op2));

Zend/zend_vm_execute.h

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)