@@ -523,35 +523,42 @@ static ZEND_COLD bool zend_null_arg_deprecated(const char *fallback_type, uint32
523523 return !EG (exception );
524524}
525525
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 ) /* {{{ */
527527{
528+ zend_opt_bool result ;
528529 if (EXPECTED (Z_TYPE_P (arg ) <= IS_STRING )) {
529530 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 ;
531533 }
532- * dest = zend_is_true (arg );
534+ result .value = zend_is_true (arg );
535+ result .has_value = true;
533536 } else {
534- return 0 ;
537+ result . has_value = false ;
535538 }
536- return 1 ;
539+ return result ;
537540}
538541/* }}} */
539542
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 ) /* {{{ */
541544{
542545 if (UNEXPECTED (ZEND_ARG_USES_STRICT_TYPES ())) {
543- return 0 ;
546+ zend_opt_bool result ;
547+ result .has_value = false;
548+ return result ;
544549 }
545- return zend_parse_arg_bool_weak (arg , dest , arg_num );
550+ return zend_parse_arg_bool_weak (arg , arg_num );
546551}
547552/* }}} */
548553
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 )
550555{
551556 if (UNEXPECTED (ZEND_FLF_ARG_USES_STRICT_TYPES ())) {
552- return 0 ;
557+ zend_opt_bool result ;
558+ result .has_value = false;
559+ return result ;
553560 }
554- return zend_parse_arg_bool_weak (arg , dest , arg_num );
561+ return zend_parse_arg_bool_weak (arg , arg_num );
555562}
556563
557564ZEND_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
653660 return zend_parse_arg_long_weak (arg , arg_num );
654661}
655662
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 ) /* {{{ */
657664{
665+ zend_opt_double result ;
658666 if (EXPECTED (Z_TYPE_P (arg ) == IS_LONG )) {
659- * dest = (double )Z_LVAL_P (arg );
667+ result . value = (double )Z_LVAL_P (arg );
660668 } else if (EXPECTED (Z_TYPE_P (arg ) == IS_STRING )) {
661669 zend_long l ;
662670 uint8_t type ;
663671
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 )) {
665673 if (EXPECTED (type != 0 )) {
666- * dest = (double )(l );
667- } else {
668- return 0 ;
674+ result .value = (double )(l );
675+ result .has_value = true;
669676 }
677+ return result ;
670678 }
671679 if (UNEXPECTED (EG (exception ))) {
672- return 0 ;
680+ result .has_value = false;
681+ return result ;
673682 }
674683 } else if (EXPECTED (Z_TYPE_P (arg ) < IS_TRUE )) {
675684 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 ;
677687 }
678- * dest = 0.0 ;
688+ result . value = 0.0 ;
679689 } else if (EXPECTED (Z_TYPE_P (arg ) == IS_TRUE )) {
680- * dest = 1.0 ;
681- } else {
682- return 0 ;
690+ result .value = 1.0 ;
683691 }
684- return 1 ;
692+ result .has_value = true;
693+ return result ;
685694}
686695/* }}} */
687696
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 ) /* {{{ */
689698{
690699 if (EXPECTED (Z_TYPE_P (arg ) == IS_LONG )) {
691700 /* 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 ;
693705 } else if (UNEXPECTED (ZEND_ARG_USES_STRICT_TYPES ())) {
694- return 0 ;
706+ zend_opt_double result ;
707+ result .has_value = false;
708+ return result ;
695709 }
696- return zend_parse_arg_double_weak (arg , dest , arg_num );
710+ return zend_parse_arg_double_weak (arg , arg_num );
697711}
698712/* }}} */
699713
0 commit comments