summaryrefslogtreecommitdiff
path: root/ext/intl
diff options
context:
space:
mode:
authorSara Golemon <pollita@php.net>2017-07-26 18:55:46 -0400
committerSara Golemon <pollita@php.net>2017-07-26 18:55:46 -0400
commit80f4297c25ca3e1f2378e00d6a54d148c62de530 (patch)
tree19d3b213b18da6a86f226b292395b91ea1319dd3 /ext/intl
parent4cde48bb738e42c7ddb99a177cebf34094f8dda2 (diff)
parentc7aa8ba0eed1c227ba4e41a28b8ca125b99b80f9 (diff)
downloadphp-git-80f4297c25ca3e1f2378e00d6a54d148c62de530.tar.gz
Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0: Bugfix #74993 Wrong reflection param into for some intl: lookup_*() methods
Diffstat (limited to 'ext/intl')
-rw-r--r--ext/intl/php_intl.c42
-rw-r--r--ext/intl/tests/locale/bug74993.phpt73
2 files changed, 94 insertions, 21 deletions
diff --git a/ext/intl/php_intl.c b/ext/intl/php_intl.c
index dc364678ac..77cb2bac3c 100644
--- a/ext/intl/php_intl.c
+++ b/ext/intl/php_intl.c
@@ -173,29 +173,29 @@ ZEND_BEGIN_ARG_INFO_EX(numfmt_parse_currency_arginfo, 0, 0, 3)
ZEND_ARG_INFO(1, position)
ZEND_END_ARG_INFO()
-ZEND_BEGIN_ARG_INFO_EX(locale_0_args, 0, 0, 0)
+ZEND_BEGIN_ARG_INFO_EX( locale_get_loc_in_loc_args, 0, ZEND_RETURN_VALUE, 1 )
+ ZEND_ARG_INFO(0, locale)
+ ZEND_ARG_INFO(0, in_locale)
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_filter_matches_args, 0, ZEND_RETURN_VALUE, 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_2_args, 0, 0, 2)
- ZEND_ARG_INFO(0, arg1)
- ZEND_ARG_INFO(0, arg2)
+ZEND_BEGIN_ARG_INFO_EX( locale_lookup_args, 0, ZEND_RETURN_VALUE, 2 )
+ ZEND_ARG_INFO(0, langtag)
+ ZEND_ARG_INFO(0, locale)
+ ZEND_ARG_INFO(0, canonicalize)
+ ZEND_ARG_INFO(0, def)
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_0_args, 0, 0, 0)
ZEND_END_ARG_INFO()
-ZEND_BEGIN_ARG_INFO_EX(locale_4_args, 0, 0, 4)
+ZEND_BEGIN_ARG_INFO_EX(locale_1_arg, 0, 0, 1)
ZEND_ARG_INFO(0, arg1)
- ZEND_ARG_INFO(0, arg2)
- ZEND_ARG_INFO(0, arg3)
- ZEND_ARG_INFO(0, arg4)
ZEND_END_ARG_INFO()
#define intl_0_args collator_static_0_args
@@ -670,17 +670,17 @@ zend_function_entry intl_functions[] = {
PHP_FE( locale_get_script, locale_1_arg )
PHP_FE( locale_get_region, locale_1_arg )
PHP_FE( locale_get_keywords, locale_1_arg )
- PHP_FE( locale_get_display_script, locale_2_args )
- PHP_FE( locale_get_display_region, locale_2_args )
- PHP_FE( locale_get_display_name, locale_2_args )
- PHP_FE( locale_get_display_language, locale_2_args)
- PHP_FE( locale_get_display_variant, locale_2_args )
+ PHP_FE( locale_get_display_script, locale_get_loc_in_loc_args )
+ PHP_FE( locale_get_display_region, locale_get_loc_in_loc_args )
+ PHP_FE( locale_get_display_name, locale_get_loc_in_loc_args )
+ PHP_FE( locale_get_display_language, locale_get_loc_in_loc_args)
+ PHP_FE( locale_get_display_variant, locale_get_loc_in_loc_args )
PHP_FE( locale_compose, locale_1_arg )
PHP_FE( locale_parse, locale_1_arg )
PHP_FE( locale_get_all_variants, locale_1_arg )
- PHP_FE( locale_filter_matches, locale_3_args )
+ PHP_FE( locale_filter_matches, locale_filter_matches_args )
PHP_FE( locale_canonicalize, locale_1_arg )
- PHP_FE( locale_lookup, locale_4_args )
+ PHP_FE( locale_lookup, locale_lookup_args )
PHP_FE( locale_accept_from_http, locale_1_arg )
/* MessageFormatter functions */
diff --git a/ext/intl/tests/locale/bug74993.phpt b/ext/intl/tests/locale/bug74993.phpt
new file mode 100644
index 0000000000..85d97ec78e
--- /dev/null
+++ b/ext/intl/tests/locale/bug74993.phpt
@@ -0,0 +1,73 @@
+--TEST--
+Bug #74993 Wrong reflection on some locale_* functions
+--SKIPIF--
+<?php
+extension_loaded('intl') || print 'skip';
+--FILE--
+<?php
+$funcs = [
+ 'locale_get_display_language',
+ 'locale_get_display_name',
+ 'locale_get_display_region',
+ 'locale_get_display_script',
+ 'locale_get_display_variant',
+ 'locale_filter_matches',
+ 'locale_lookup',
+];
+
+foreach ($funcs as $func) {
+ echo (new ReflectionFunction($func));
+}
+--EXPECT--
+Function [ <internal:intl> function locale_get_display_language ] {
+
+ - Parameters [2] {
+ Parameter #0 [ <required> $locale ]
+ Parameter #1 [ <optional> $in_locale ]
+ }
+}
+Function [ <internal:intl> function locale_get_display_name ] {
+
+ - Parameters [2] {
+ Parameter #0 [ <required> $locale ]
+ Parameter #1 [ <optional> $in_locale ]
+ }
+}
+Function [ <internal:intl> function locale_get_display_region ] {
+
+ - Parameters [2] {
+ Parameter #0 [ <required> $locale ]
+ Parameter #1 [ <optional> $in_locale ]
+ }
+}
+Function [ <internal:intl> function locale_get_display_script ] {
+
+ - Parameters [2] {
+ Parameter #0 [ <required> $locale ]
+ Parameter #1 [ <optional> $in_locale ]
+ }
+}
+Function [ <internal:intl> function locale_get_display_variant ] {
+
+ - Parameters [2] {
+ Parameter #0 [ <required> $locale ]
+ Parameter #1 [ <optional> $in_locale ]
+ }
+}
+Function [ <internal:intl> function locale_filter_matches ] {
+
+ - Parameters [3] {
+ Parameter #0 [ <required> $langtag ]
+ Parameter #1 [ <required> $locale ]
+ Parameter #2 [ <optional> $canonicalize ]
+ }
+}
+Function [ <internal:intl> function locale_lookup ] {
+
+ - Parameters [4] {
+ Parameter #0 [ <required> $langtag ]
+ Parameter #1 [ <required> $locale ]
+ Parameter #2 [ <optional> $canonicalize ]
+ Parameter #3 [ <optional> $def ]
+ }
+}