com php-src: Fix bug #74468 wrong reflection on Collator::sortWithSortKeys: NEWS ext/intl/collator/collator_class.c ext/intl/php_in tl.c ext/intl/tests/bug74468.phpt

[email protected] (Joe Watkins)
Newsgroups php.cvs
Message-ID <[email protected]>
Commit:    f50df1d0e33aaf5007670966ca067318e064df82
Author:    Fabien Villepinte <[email protected]>         Tue, 18 Apr 2017 17:03:42 +0200
Committer: Joe Watkins <[email protected]>      Tue, 2 May 2017 06:20:40 +0100
Parents:   a581e641994908af2ffdcac652ad14c34fbdef4c
Branches:  PHP-7.0 PHP-7.1 master

Link:       http://git.php.net/?p=php-src.git;a=commitdiff;h=f50df1d0e33aaf5007670966ca067318e064df82

Log:
Fix bug #74468 wrong reflection on Collator::sortWithSortKeys

Bugs:
https://bugs.php.net/74468

Changed paths:
  M  NEWS
  M  ext/intl/collator/collator_class.c
  M  ext/intl/php_intl.c
  A  ext/intl/tests/bug74468.phpt


Diff:
diff --git a/NEWS b/NEWS
index 3ee633e..ec8b4f9 100644
--- a/NEWS
+++ b/NEWS
@@ -2,7 +2,8 @@ PHP                                                                        NEWS
 |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
 ?? ??? 2017 PHP 7.0.20
 
-
+- intl:
+  . Fixed bug #74468 (wrong reflection on Collator::sortWithSortKeys). (villfa)
 
 11 May 2017 PHP 7.0.19
 
diff --git a/ext/intl/collator/collator_class.c b/ext/intl/collator/collator_class.c
index 4fc7067..0821cb1 100644
--- a/ext/intl/collator/collator_class.c
+++ b/ext/intl/collator/collator_class.c
@@ -95,6 +95,10 @@ ZEND_BEGIN_ARG_INFO_EX( collator_sort_args, 0, 0, 1 )
 	ZEND_ARG_INFO( 0, flags )
 ZEND_END_ARG_INFO()
 
+ZEND_BEGIN_ARG_INFO_EX( collator_sort_with_sort_keys_args, 0, 0, 1 )
+	ZEND_ARG_ARRAY_INFO( 1, arr, 0 )
+ZEND_END_ARG_INFO()
+
 /* }}} */
 
 /* {{{ Collator_class_functions
@@ -106,7 +110,7 @@ zend_function_entry Collator_class_functions[] = {
 	ZEND_FENTRY( create, ZEND_FN( collator_create ), collator_1_arg, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC )
 	PHP_NAMED_FE( compare, ZEND_FN( collator_compare ), collator_2_args )
 	PHP_NAMED_FE( sort, ZEND_FN( collator_sort ), collator_sort_args )
-	PHP_NAMED_FE( sortWithSortKeys, ZEND_FN( collator_sort_with_sort_keys ), collator_sort_args )
+	PHP_NAMED_FE( sortWithSortKeys, ZEND_FN( collator_sort_with_sort_keys ), collator_sort_with_sort_keys_args )
 	PHP_NAMED_FE( asort, ZEND_FN( collator_asort ), collator_sort_args )
 	PHP_NAMED_FE( getAttribute, ZEND_FN( collator_get_attribute ), collator_1_arg )
 	PHP_NAMED_FE( setAttribute, ZEND_FN( collator_set_attribute ), collator_2_args )
diff --git a/ext/intl/php_intl.c b/ext/intl/php_intl.c
index fd35e57..787cb48 100644
--- a/ext/intl/php_intl.c
+++ b/ext/intl/php_intl.c
@@ -159,6 +159,11 @@ ZEND_BEGIN_ARG_INFO_EX(collator_sort_args, 0, 0, 2)
 	ZEND_ARG_INFO(0, sort_flags)
 ZEND_END_ARG_INFO()
 
+ZEND_BEGIN_ARG_INFO_EX(collator_sort_with_sort_keys_args, 0, 0, 2)
+	ZEND_ARG_OBJ_INFO(0, coll, Collator, 0)
+	ZEND_ARG_ARRAY_INFO(1, arr, 0)
+ZEND_END_ARG_INFO()
+
 ZEND_BEGIN_ARG_INFO_EX(numfmt_parse_arginfo, 0, 0, 2)
 	ZEND_ARG_INFO(0, formatter)
 	ZEND_ARG_INFO(0, string)
@@ -645,7 +650,7 @@ zend_function_entry intl_functions[] = {
 	PHP_FE( collator_get_strength, collator_0_args )
 	PHP_FE( collator_set_strength, collator_1_arg )
 	PHP_FE( collator_sort, collator_sort_args )
-	PHP_FE( collator_sort_with_sort_keys, collator_sort_args )
+	PHP_FE( collator_sort_with_sort_keys, collator_sort_with_sort_keys_args )
 	PHP_FE( collator_asort, collator_sort_args )
 	PHP_FE( collator_get_locale, collator_1_arg )
 	PHP_FE( collator_get_error_code, collator_0_args )
diff --git a/ext/intl/tests/bug74468.phpt b/ext/intl/tests/bug74468.phpt
new file mode 100644
index 0000000..63d469e
--- /dev/null
+++ b/ext/intl/tests/bug74468.phpt
@@ -0,0 +1,22 @@
+--TEST--
+Bug #74468 Wrong reflection on Collator::sortWithSortKeys
+--SKIPIF--
+<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
+<?php if (version_compare(INTL_ICU_VERSION, '51.2') >=  0) die('skip for ICU < 51.2'); ?>
+--FILE--
+<?php
+$rm = new ReflectionMethod(Collator::class, 'sortWithSortKeys');
+var_dump($rm->getNumberOfParameters());
+var_dump($rm->getNumberOfRequiredParameters());
+
+$rf = new ReflectionFunction('collator_sort_with_sort_keys');
+var_dump($rf->getNumberOfParameters());
+var_dump($rf->getNumberOfRequiredParameters());
+?>
+===DONE===
+--EXPECT--
+int(1)
+int(1)
+int(2)
+int(2)
+===DONE===
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.