@@ -523,35 +523,42 @@ static ZEND_COLD bool zend_null_arg_deprecated(const char *fallback_type, uint32
523
523
return !EG (exception );
524
524
}
525
525
526
- ZEND_API bool ZEND_FASTCALL zend_parse_arg_bool_weak (const zval * arg , bool * dest , uint32_t arg_num ) /* {{{ */
526
+ ZEND_API zend_opt_bool ZEND_FASTCALL zend_parse_arg_bool_weak (const zval * arg , uint32_t arg_num ) /* {{{ */
527
527
{
528
+ zend_opt_bool result ;
528
529
if (EXPECTED (Z_TYPE_P (arg ) <= IS_STRING )) {
529
530
if (UNEXPECTED (Z_TYPE_P (arg ) == IS_NULL ) && !zend_null_arg_deprecated ("bool" , arg_num )) {
530
- return 0 ;
531
+ result .has_value = false;
532
+ return result ;
531
533
}
532
- * dest = zend_is_true (arg );
534
+ result .value = zend_is_true (arg );
535
+ result .has_value = true;
533
536
} else {
534
- return 0 ;
537
+ result . has_value = false ;
535
538
}
536
- return 1 ;
539
+ return result ;
537
540
}
538
541
/* }}} */
539
542
540
- ZEND_API bool ZEND_FASTCALL zend_parse_arg_bool_slow (const zval * arg , bool * dest , uint32_t arg_num ) /* {{{ */
543
+ ZEND_API zend_opt_bool ZEND_FASTCALL zend_parse_arg_bool_slow (const zval * arg , uint32_t arg_num ) /* {{{ */
541
544
{
542
545
if (UNEXPECTED (ZEND_ARG_USES_STRICT_TYPES ())) {
543
- return 0 ;
546
+ zend_opt_bool result ;
547
+ result .has_value = false;
548
+ return result ;
544
549
}
545
- return zend_parse_arg_bool_weak (arg , dest , arg_num );
550
+ return zend_parse_arg_bool_weak (arg , arg_num );
546
551
}
547
552
/* }}} */
548
553
549
- ZEND_API bool ZEND_FASTCALL zend_flf_parse_arg_bool_slow (const zval * arg , bool * dest , uint32_t arg_num )
554
+ ZEND_API zend_opt_bool ZEND_FASTCALL zend_flf_parse_arg_bool_slow (const zval * arg , uint32_t arg_num )
550
555
{
551
556
if (UNEXPECTED (ZEND_FLF_ARG_USES_STRICT_TYPES ())) {
552
- return 0 ;
557
+ zend_opt_bool result ;
558
+ result .has_value = false;
559
+ return result ;
553
560
}
554
- return zend_parse_arg_bool_weak (arg , dest , arg_num );
561
+ return zend_parse_arg_bool_weak (arg , arg_num );
555
562
}
556
563
557
564
ZEND_API zend_opt_long ZEND_FASTCALL zend_parse_arg_long_weak (const zval * arg , uint32_t arg_num ) /* {{{ */
@@ -653,47 +660,54 @@ ZEND_API zend_opt_long ZEND_FASTCALL zend_flf_parse_arg_long_slow(const zval *ar
653
660
return zend_parse_arg_long_weak (arg , arg_num );
654
661
}
655
662
656
- ZEND_API bool ZEND_FASTCALL zend_parse_arg_double_weak (const zval * arg , double * dest , uint32_t arg_num ) /* {{{ */
663
+ ZEND_API zend_opt_double ZEND_FASTCALL zend_parse_arg_double_weak (const zval * arg , uint32_t arg_num ) /* {{{ */
657
664
{
665
+ zend_opt_double result ;
658
666
if (EXPECTED (Z_TYPE_P (arg ) == IS_LONG )) {
659
- * dest = (double )Z_LVAL_P (arg );
667
+ result . value = (double )Z_LVAL_P (arg );
660
668
} else if (EXPECTED (Z_TYPE_P (arg ) == IS_STRING )) {
661
669
zend_long l ;
662
670
uint8_t type ;
663
671
664
- if (UNEXPECTED ((type = is_numeric_str_function (Z_STR_P (arg ), & l , dest )) != IS_DOUBLE )) {
672
+ if (UNEXPECTED ((type = is_numeric_str_function (Z_STR_P (arg ), & l , & result . value )) != IS_DOUBLE )) {
665
673
if (EXPECTED (type != 0 )) {
666
- * dest = (double )(l );
667
- } else {
668
- return 0 ;
674
+ result .value = (double )(l );
675
+ result .has_value = true;
669
676
}
677
+ return result ;
670
678
}
671
679
if (UNEXPECTED (EG (exception ))) {
672
- return 0 ;
680
+ result .has_value = false;
681
+ return result ;
673
682
}
674
683
} else if (EXPECTED (Z_TYPE_P (arg ) < IS_TRUE )) {
675
684
if (UNEXPECTED (Z_TYPE_P (arg ) == IS_NULL ) && !zend_null_arg_deprecated ("float" , arg_num )) {
676
- return 0 ;
685
+ result .has_value = false;
686
+ return result ;
677
687
}
678
- * dest = 0.0 ;
688
+ result . value = 0.0 ;
679
689
} else if (EXPECTED (Z_TYPE_P (arg ) == IS_TRUE )) {
680
- * dest = 1.0 ;
681
- } else {
682
- return 0 ;
690
+ result .value = 1.0 ;
683
691
}
684
- return 1 ;
692
+ result .has_value = true;
693
+ return result ;
685
694
}
686
695
/* }}} */
687
696
688
- ZEND_API bool ZEND_FASTCALL zend_parse_arg_double_slow (const zval * arg , double * dest , uint32_t arg_num ) /* {{{ */
697
+ ZEND_API zend_opt_double ZEND_FASTCALL zend_parse_arg_double_slow (const zval * arg , uint32_t arg_num ) /* {{{ */
689
698
{
690
699
if (EXPECTED (Z_TYPE_P (arg ) == IS_LONG )) {
691
700
/* SSTH Exception: IS_LONG may be accepted instead as IS_DOUBLE */
692
- * dest = (double )Z_LVAL_P (arg );
701
+ zend_opt_double result ;
702
+ result .has_value = true;
703
+ result .value = (double )Z_LVAL_P (arg );
704
+ return result ;
693
705
} else if (UNEXPECTED (ZEND_ARG_USES_STRICT_TYPES ())) {
694
- return 0 ;
706
+ zend_opt_double result ;
707
+ result .has_value = false;
708
+ return result ;
695
709
}
696
- return zend_parse_arg_double_weak (arg , dest , arg_num );
710
+ return zend_parse_arg_double_weak (arg , arg_num );
697
711
}
698
712
/* }}} */
699
713
0 commit comments