@@ -509,35 +509,33 @@ static ZEND_COLD bool zend_null_arg_deprecated(const char *fallback_type, uint32
509509 return !EG (exception );
510510}
511511
512- ZEND_API bool ZEND_FASTCALL zend_parse_arg_bool_weak (const zval * arg , bool * dest , uint32_t arg_num ) /* {{{ */
512+ ZEND_API zpp_parse_bool_status ZEND_FASTCALL zend_parse_arg_bool_weak (const zval * arg , uint32_t arg_num ) /* {{{ */
513513{
514514 if (EXPECTED (Z_TYPE_P (arg ) <= IS_STRING )) {
515515 if (UNEXPECTED (Z_TYPE_P (arg ) == IS_NULL ) && !zend_null_arg_deprecated ("bool" , arg_num )) {
516- return 0 ;
516+ return ZPP_PARSE_BOOL_STATUS_ERROR ;
517517 }
518- * dest = zend_is_true (arg );
519- } else {
520- return 0 ;
518+ return zend_is_true (arg );
521519 }
522- return 1 ;
520+ return ZPP_PARSE_BOOL_STATUS_ERROR ;
523521}
524522/* }}} */
525523
526- ZEND_API bool ZEND_FASTCALL zend_parse_arg_bool_slow (const zval * arg , bool * dest , uint32_t arg_num ) /* {{{ */
524+ ZEND_API zpp_parse_bool_status ZEND_FASTCALL zend_parse_arg_bool_slow (const zval * arg , uint32_t arg_num ) /* {{{ */
527525{
528526 if (UNEXPECTED (ZEND_ARG_USES_STRICT_TYPES ())) {
529- return 0 ;
527+ return ZPP_PARSE_BOOL_STATUS_ERROR ;
530528 }
531- return zend_parse_arg_bool_weak (arg , dest , arg_num );
529+ return zend_parse_arg_bool_weak (arg , arg_num );
532530}
533531/* }}} */
534532
535- ZEND_API bool ZEND_FASTCALL zend_flf_parse_arg_bool_slow (const zval * arg , bool * dest , uint32_t arg_num )
533+ ZEND_API zpp_parse_bool_status ZEND_FASTCALL zend_flf_parse_arg_bool_slow (const zval * arg , uint32_t arg_num )
536534{
537535 if (UNEXPECTED (ZEND_FLF_ARG_USES_STRICT_TYPES ())) {
538- return 0 ;
536+ return ZPP_PARSE_BOOL_STATUS_ERROR ;
539537 }
540- return zend_parse_arg_bool_weak (arg , dest , arg_num );
538+ return zend_parse_arg_bool_weak (arg , arg_num );
541539}
542540
543541ZEND_API bool ZEND_FASTCALL zend_parse_arg_long_weak (const zval * arg , zend_long * dest , uint32_t arg_num ) /* {{{ */
@@ -624,44 +622,46 @@ ZEND_API bool ZEND_FASTCALL zend_flf_parse_arg_long_slow(const zval *arg, zend_l
624622 return zend_parse_arg_long_weak (arg , dest , arg_num );
625623}
626624
627- ZEND_API bool ZEND_FASTCALL zend_parse_arg_double_weak (const zval * arg , double * dest , uint32_t arg_num ) /* {{{ */
625+ ZEND_API double ZEND_FASTCALL zend_parse_arg_double_weak (const zval * arg , uint32_t arg_num ) /* {{{ */
628626{
629627 if (EXPECTED (Z_TYPE_P (arg ) == IS_LONG )) {
630- * dest = (double )Z_LVAL_P (arg );
628+ return (double )Z_LVAL_P (arg );
631629 } else if (EXPECTED (Z_TYPE_P (arg ) == IS_STRING )) {
632630 zend_long l ;
631+ double dval ;
633632 uint8_t type ;
634633
635- if (UNEXPECTED ((type = is_numeric_str_function (Z_STR_P (arg ), & l , dest )) != IS_DOUBLE )) {
634+ if (UNEXPECTED ((type = is_numeric_str_function (Z_STR_P (arg ), & l , & dval )) != IS_DOUBLE )) {
636635 if (EXPECTED (type != 0 )) {
637- * dest = (double )(l );
636+ return (double )(l );
638637 } else {
639- return 0 ;
638+ return NAN ;
640639 }
640+ } else {
641+ return dval ;
641642 }
642643 } else if (EXPECTED (Z_TYPE_P (arg ) < IS_TRUE )) {
643644 if (UNEXPECTED (Z_TYPE_P (arg ) == IS_NULL ) && !zend_null_arg_deprecated ("float" , arg_num )) {
644- return 0 ;
645+ return NAN ;
645646 }
646- * dest = 0.0 ;
647+ return 0.0 ;
647648 } else if (EXPECTED (Z_TYPE_P (arg ) == IS_TRUE )) {
648- * dest = 1.0 ;
649+ return 1.0 ;
649650 } else {
650- return 0 ;
651+ return NAN ;
651652 }
652- return 1 ;
653653}
654654/* }}} */
655655
656- ZEND_API bool ZEND_FASTCALL zend_parse_arg_double_slow (const zval * arg , double * dest , uint32_t arg_num ) /* {{{ */
656+ ZEND_API double ZEND_FASTCALL zend_parse_arg_double_slow (const zval * arg , uint32_t arg_num ) /* {{{ */
657657{
658658 if (EXPECTED (Z_TYPE_P (arg ) == IS_LONG )) {
659659 /* SSTH Exception: IS_LONG may be accepted instead as IS_DOUBLE */
660- * dest = (double )Z_LVAL_P (arg );
660+ return (double )Z_LVAL_P (arg );
661661 } else if (UNEXPECTED (ZEND_ARG_USES_STRICT_TYPES ())) {
662- return 0 ;
662+ return NAN ;
663663 }
664- return zend_parse_arg_double_weak (arg , dest , arg_num );
664+ return zend_parse_arg_double_weak (arg , arg_num );
665665}
666666/* }}} */
667667
@@ -728,58 +728,58 @@ ZEND_API bool ZEND_FASTCALL zend_parse_arg_number_or_str_slow(zval *arg, zval **
728728 return true;
729729}
730730
731- ZEND_API bool ZEND_FASTCALL zend_parse_arg_str_weak (zval * arg , zend_string * * dest , uint32_t arg_num ) /* {{{ */
731+ ZEND_API zend_string * ZEND_FASTCALL zend_parse_arg_str_weak (zval * arg , uint32_t arg_num ) /* {{{ */
732732{
733733 if (EXPECTED (Z_TYPE_P (arg ) < IS_STRING )) {
734734 if (UNEXPECTED (Z_TYPE_P (arg ) == IS_NULL ) && !zend_null_arg_deprecated ("string" , arg_num )) {
735- return 0 ;
735+ return NULL ;
736736 }
737737 convert_to_string (arg );
738- * dest = Z_STR_P (arg );
738+ return Z_STR_P (arg );
739739 } else if (UNEXPECTED (Z_TYPE_P (arg ) == IS_OBJECT )) {
740740 zend_object * zobj = Z_OBJ_P (arg );
741741 zval obj ;
742742 if (zobj -> handlers -> cast_object (zobj , & obj , IS_STRING ) == SUCCESS ) {
743743 OBJ_RELEASE (zobj );
744744 ZVAL_COPY_VALUE (arg , & obj );
745- * dest = Z_STR_P (arg );
746- return 1 ;
745+ return Z_STR_P (arg );
747746 }
748- return 0 ;
747+ return NULL ;
749748 } else {
750- return 0 ;
749+ return NULL ;
751750 }
752- return 1 ;
753751}
754752/* }}} */
755753
756- ZEND_API bool ZEND_FASTCALL zend_parse_arg_str_slow (zval * arg , zend_string * * dest , uint32_t arg_num ) /* {{{ */
754+ ZEND_API zend_string * ZEND_FASTCALL zend_parse_arg_str_slow (zval * arg , uint32_t arg_num ) /* {{{ */
757755{
758756 if (UNEXPECTED (ZEND_ARG_USES_STRICT_TYPES ())) {
759- return 0 ;
757+ return NULL ;
760758 }
761- return zend_parse_arg_str_weak (arg , dest , arg_num );
759+ return zend_parse_arg_str_weak (arg , arg_num );
762760}
763761/* }}} */
764762
765- ZEND_API bool ZEND_FASTCALL zend_flf_parse_arg_str_slow (zval * arg , zend_string * * dest , uint32_t arg_num )
763+ ZEND_API zend_string * ZEND_FASTCALL zend_flf_parse_arg_str_slow (zval * arg , uint32_t arg_num )
766764{
767765 if (UNEXPECTED (ZEND_FLF_ARG_USES_STRICT_TYPES ())) {
768- return 0 ;
766+ return NULL ;
769767 }
770- return zend_parse_arg_str_weak (arg , dest , arg_num );
768+ return zend_parse_arg_str_weak (arg , arg_num );
771769}
772770
773771ZEND_API bool ZEND_FASTCALL zend_parse_arg_str_or_long_slow (zval * arg , zend_string * * dest_str , zend_long * dest_long , uint32_t arg_num ) /* {{{ */
774772{
773+ zend_string * str ;
775774 if (UNEXPECTED (ZEND_ARG_USES_STRICT_TYPES ())) {
776775 return 0 ;
777776 }
778777 if (zend_parse_arg_long_weak (arg , dest_long , arg_num )) {
779778 * dest_str = NULL ;
780779 return 1 ;
781- } else if (zend_parse_arg_str_weak (arg , dest_str , arg_num )) {
780+ } else if (( str = zend_parse_arg_str_weak (arg , arg_num )) != NULL ) {
782781 * dest_long = 0 ;
782+ * dest_str = str ;
783783 return 1 ;
784784 } else {
785785 return 0 ;
0 commit comments