From 7dc6b04f453d0111447a3bcd1f3e88a5c32c2a22 Mon Sep 17 00:00:00 2001 From: Fabien Villepinte Date: Fri, 14 Apr 2017 14:08:26 +0200 Subject: [PATCH] Fixed bug #74439 Wrong reflection on the Locale methods --- NEWS | 1 + ext/intl/locale/locale_class.c | 60 ++++++++++++++++------------- ext/intl/tests/locale_bug74439.phpt | 54 ++++++++++++++++++++++++++ 3 files changed, 89 insertions(+), 26 deletions(-) create mode 100644 ext/intl/tests/locale_bug74439.phpt diff --git a/NEWS b/NEWS index 08a31372cfb..59420cc6bdc 100644 --- a/NEWS +++ b/NEWS @@ -25,6 +25,7 @@ PHP NEWS - intl: . Fixed bug #74433 (wrong reflection for Normalizer methods). (villfa) + . Fixed bug #74439 (wrong reflection for Locale methods). (villfa) - MySQLnd: . Added support for MySQL 8.0 types. (Johannes) diff --git a/ext/intl/locale/locale_class.c b/ext/intl/locale/locale_class.c index 6300666c598..d132ef8c764 100644 --- a/ext/intl/locale/locale_class.c +++ b/ext/intl/locale/locale_class.c @@ -38,26 +38,34 @@ zend_class_entry *Locale_ce_ptr = NULL; ZEND_BEGIN_ARG_INFO_EX( locale_0_args, 0, 0, 0 ) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX( locale_1_arg, 0, 0, 1 ) - ZEND_ARG_INFO( 0, arg1 ) +ZEND_BEGIN_ARG_INFO_EX( locale_arg_locale, 0, 0, 1 ) + ZEND_ARG_INFO( 0, locale ) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX( locale_2_args, 0, 0, 2 ) - ZEND_ARG_INFO( 0, arg1 ) - ZEND_ARG_INFO( 0, arg2 ) +ZEND_BEGIN_ARG_INFO_EX( locale_accept_from_http_args, 0, 0, 1 ) + ZEND_ARG_INFO( 0, header ) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX( locale_3_args, 0, 0, 3 ) - ZEND_ARG_INFO( 0, arg1 ) - ZEND_ARG_INFO( 0, arg2 ) - ZEND_ARG_INFO( 0, arg3 ) +ZEND_BEGIN_ARG_INFO_EX( locale_compose_args, 0, 0, 1 ) + ZEND_ARG_INFO( 0, subtags ) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX( locale_4_args, 0, 0, 4 ) - ZEND_ARG_INFO( 0, arg1 ) - ZEND_ARG_INFO( 0, arg2 ) - ZEND_ARG_INFO( 0, arg3 ) - ZEND_ARG_INFO( 0, arg4 ) +ZEND_BEGIN_ARG_INFO_EX( locale_2_args, 0, 0, 1 ) + ZEND_ARG_INFO( 0, locale ) + ZEND_ARG_INFO( 0, in_locale ) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX( locale_filter_matches_args, 0, 0, 2 ) + ZEND_ARG_INFO( 0, langtag ) + ZEND_ARG_INFO( 0, locale ) + ZEND_ARG_INFO( 0, canonicalize ) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX( locale_lookup_args, 0, 0, 2 ) + ZEND_ARG_INFO( 0, langtag ) + ZEND_ARG_INFO( 0, locale ) + ZEND_ARG_INFO( 0, canonicalize ) + ZEND_ARG_INFO( 0, default ) ZEND_END_ARG_INFO() /* }}} */ @@ -68,23 +76,23 @@ ZEND_END_ARG_INFO() zend_function_entry Locale_class_functions[] = { ZEND_FENTRY( getDefault, zif_locale_get_default , locale_0_args , ZEND_ACC_PUBLIC|ZEND_ACC_STATIC ) - ZEND_FENTRY( setDefault, zif_locale_set_default , locale_1_arg , ZEND_ACC_PUBLIC|ZEND_ACC_STATIC ) - ZEND_FENTRY( getPrimaryLanguage, ZEND_FN( locale_get_primary_language ), locale_1_arg , ZEND_ACC_PUBLIC|ZEND_ACC_STATIC ) - ZEND_FENTRY( getScript, ZEND_FN( locale_get_script ), locale_1_arg , ZEND_ACC_PUBLIC|ZEND_ACC_STATIC ) - ZEND_FENTRY( getRegion, ZEND_FN( locale_get_region ), locale_1_arg , ZEND_ACC_PUBLIC|ZEND_ACC_STATIC ) - ZEND_FENTRY( getKeywords, ZEND_FN( locale_get_keywords ), locale_1_arg , ZEND_ACC_PUBLIC|ZEND_ACC_STATIC ) + ZEND_FENTRY( setDefault, zif_locale_set_default , locale_arg_locale , ZEND_ACC_PUBLIC|ZEND_ACC_STATIC ) + ZEND_FENTRY( getPrimaryLanguage, ZEND_FN( locale_get_primary_language ), locale_arg_locale , ZEND_ACC_PUBLIC|ZEND_ACC_STATIC ) + ZEND_FENTRY( getScript, ZEND_FN( locale_get_script ), locale_arg_locale , ZEND_ACC_PUBLIC|ZEND_ACC_STATIC ) + ZEND_FENTRY( getRegion, ZEND_FN( locale_get_region ), locale_arg_locale , ZEND_ACC_PUBLIC|ZEND_ACC_STATIC ) + ZEND_FENTRY( getKeywords, ZEND_FN( locale_get_keywords ), locale_arg_locale , ZEND_ACC_PUBLIC|ZEND_ACC_STATIC ) ZEND_FENTRY( getDisplayScript, ZEND_FN( locale_get_display_script ), locale_2_args , ZEND_ACC_PUBLIC|ZEND_ACC_STATIC ) ZEND_FENTRY( getDisplayRegion, ZEND_FN( locale_get_display_region ), locale_2_args , ZEND_ACC_PUBLIC|ZEND_ACC_STATIC ) ZEND_FENTRY( getDisplayName, ZEND_FN( locale_get_display_name ), locale_2_args , ZEND_ACC_PUBLIC|ZEND_ACC_STATIC ) ZEND_FENTRY( getDisplayLanguage, ZEND_FN( locale_get_display_language ), locale_2_args , ZEND_ACC_PUBLIC|ZEND_ACC_STATIC ) ZEND_FENTRY( getDisplayVariant, ZEND_FN( locale_get_display_variant ), locale_2_args , ZEND_ACC_PUBLIC|ZEND_ACC_STATIC ) - ZEND_FENTRY( composeLocale, ZEND_FN( locale_compose ), locale_1_arg , ZEND_ACC_PUBLIC|ZEND_ACC_STATIC ) - ZEND_FENTRY( parseLocale, ZEND_FN( locale_parse ), locale_1_arg , ZEND_ACC_PUBLIC|ZEND_ACC_STATIC ) - ZEND_FENTRY( getAllVariants, ZEND_FN( locale_get_all_variants ), locale_1_arg , ZEND_ACC_PUBLIC|ZEND_ACC_STATIC ) - ZEND_FENTRY( filterMatches, ZEND_FN( locale_filter_matches ), locale_3_args, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC ) - ZEND_FENTRY( lookup, ZEND_FN( locale_lookup ), locale_4_args, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC ) - ZEND_FENTRY( canonicalize, ZEND_FN( locale_canonicalize ), locale_1_arg , ZEND_ACC_PUBLIC|ZEND_ACC_STATIC ) - ZEND_FENTRY( acceptFromHttp, ZEND_FN( locale_accept_from_http ), locale_1_arg , ZEND_ACC_PUBLIC|ZEND_ACC_STATIC ) + ZEND_FENTRY( composeLocale, ZEND_FN( locale_compose ), locale_compose_args , ZEND_ACC_PUBLIC|ZEND_ACC_STATIC ) + ZEND_FENTRY( parseLocale, ZEND_FN( locale_parse ), locale_arg_locale , ZEND_ACC_PUBLIC|ZEND_ACC_STATIC ) + ZEND_FENTRY( getAllVariants, ZEND_FN( locale_get_all_variants ), locale_arg_locale , ZEND_ACC_PUBLIC|ZEND_ACC_STATIC ) + ZEND_FENTRY( filterMatches, ZEND_FN( locale_filter_matches ), locale_filter_matches_args, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC ) + ZEND_FENTRY( lookup, ZEND_FN( locale_lookup ), locale_lookup_args, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC ) + ZEND_FENTRY( canonicalize, ZEND_FN( locale_canonicalize ), locale_arg_locale , ZEND_ACC_PUBLIC|ZEND_ACC_STATIC ) + ZEND_FENTRY( acceptFromHttp, ZEND_FN( locale_accept_from_http ), locale_accept_from_http_args , ZEND_ACC_PUBLIC|ZEND_ACC_STATIC ) PHP_FE_END }; /* }}} */ diff --git a/ext/intl/tests/locale_bug74439.phpt b/ext/intl/tests/locale_bug74439.phpt new file mode 100644 index 00000000000..24407ada82a --- /dev/null +++ b/ext/intl/tests/locale_bug74439.phpt @@ -0,0 +1,54 @@ +--TEST-- +Bug #74439 Wrong reflection on the Locale methods +--SKIPIF-- + +--FILE-- +getNumberOfParameters(), $rm->getNumberOfRequiredParameters()); +} +?> +===DONE=== +--EXPECT-- +getDefault: 0, 0 +acceptFromHttp: 1, 1 +canonicalize: 1, 1 +composeLocale: 1, 1 +getAllVariants: 1, 1 +getKeywords: 1, 1 +getPrimaryLanguage: 1, 1 +getRegion: 1, 1 +getScript: 1, 1 +parseLocale: 1, 1 +setDefault: 1, 1 +getDisplayLanguage: 2, 1 +getDisplayName: 2, 1 +getDisplayRegion: 2, 1 +getDisplayScript: 2, 1 +getDisplayVariant: 2, 1 +filterMatches: 3, 2 +lookup: 4, 2 +===DONE===