]> granicus.if.org Git - php/commitdiff
Bugfix #74993 Wrong reflection param into for some intl: lookup_*() methods
authorSara Golemon <pollita@php.net>
Wed, 26 Jul 2017 21:59:29 +0000 (17:59 -0400)
committerSara Golemon <pollita@php.net>
Wed, 26 Jul 2017 22:55:23 +0000 (18:55 -0400)
NEWS
ext/intl/php_intl.c
ext/intl/tests/locale/bug74993.phpt [new file with mode: 0644]

diff --git a/NEWS b/NEWS
index 4a059537c7a07f170e6c74458c827394a3a0fb25..36121bd290516024452136792de99e3bcad0e464 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -10,6 +10,9 @@ PHP                                                                        NEWS
   . Fixed bug #74125 (Fixed finding CURL on systems with multiarch support).
     (cebe)
 
+- Intl:
+  . Fixed bug #74993 (Wrong reflection on some locale_* functions). (Sara)
+
 - Mbstring:
   . Fixed bug #71606 (Segmentation fault mb_strcut with HTML-ENTITIES encoding).
     (cmb)
index 9584be76cd98bf89f2918043107b7f057740cf00..b05e746ac50acea4e3223fa31bbe0858ba4aa90c 100644 (file)
@@ -178,29 +178,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
@@ -686,17 +686,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 (file)
index 0000000..85d97ec
--- /dev/null
@@ -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 ]
+  }
+}