@@ -4927,18 +4927,19 @@ PHP_FUNCTION(setlocale)
49274927 zend_long cat ;
49284928 zval * args = NULL ;
49294929 uint32_t num_args ;
4930+ ALLOCA_FLAG (use_heap );
49304931
49314932 ZEND_PARSE_PARAMETERS_START (2 , -1 )
49324933 Z_PARAM_LONG (cat )
49334934 Z_PARAM_VARIADIC ('+ ', args, num_args)
49344935 ZEND_PARSE_PARAMETERS_END ();
49354936
4936- if ( ZEND_ARG_USES_STRICT_TYPES ()) {
4937- for ( uint32_t i = 0 ; i < num_args ; i ++ ) {
4938- if ( UNEXPECTED ( Z_TYPE ( args [ i ]) != IS_ARRAY && Z_TYPE ( args [ i ]) != IS_STRING ) ) {
4939- zend_wrong_parameter_type_error ( i + 2 , Z_EXPECTED_ARRAY_OR_STRING , & args [i ]);
4940- RETURN_THROWS ( );
4941- }
4937+ zend_string * * strings = do_alloca ( sizeof ( zend_string * ) * num_args , use_heap );
4938+
4939+ for ( uint32_t i = 0 ; i < num_args ; i ++ ) {
4940+ if ( UNEXPECTED ( Z_TYPE ( args [ i ]) != IS_ARRAY && ! zend_parse_arg_str ( & args [i ], & strings [ i ], false, i + 2 ))) {
4941+ zend_wrong_parameter_type_error ( i + 2 , Z_EXPECTED_ARRAY_OR_STRING , & args [ i ] );
4942+ goto out ;
49424943 }
49434944 }
49444945
@@ -4948,24 +4949,29 @@ PHP_FUNCTION(setlocale)
49484949 ZEND_HASH_FOREACH_VAL (Z_ARRVAL (args [i ]), elem ) {
49494950 zend_string * result = try_setlocale_zval (cat , elem );
49504951 if (EG (exception )) {
4951- RETURN_THROWS () ;
4952+ goto out ;
49524953 }
49534954 if (result ) {
4954- RETURN_STR (result );
4955+ RETVAL_STR (result );
4956+ goto out ;
49554957 }
49564958 } ZEND_HASH_FOREACH_END ();
49574959 } else {
4958- zend_string * result = try_setlocale_zval (cat , & args [i ]);
4960+ zend_string * result = try_setlocale_str (cat , strings [i ]);
49594961 if (EG (exception )) {
4960- RETURN_THROWS () ;
4962+ goto out ;
49614963 }
49624964 if (result ) {
4963- RETURN_STR (result );
4965+ RETVAL_STR (result );
4966+ goto out ;
49644967 }
49654968 }
49664969 }
49674970
4968- RETURN_FALSE ;
4971+ RETVAL_FALSE ;
4972+
4973+ out :
4974+ free_alloca (strings , use_heap );
49694975}
49704976/* }}} */
49714977
0 commit comments