com php-src: Use zend_sort in array_multisort (test s change is expected): ext/standard/array.c ext
/standard/tests/array/array_multisort_variation7.phpt ext/standard/tests/array/array_multisort_variation8. phpt
ext/standard/tests/array/array_multisort_variation 9.phpt
| From: | Xinchen Hui | Date: | Thu, 23 Jun 2016 12:58:45 +0000 |
| Subject: | com php-src: Use zend_sort in array_multisort (test s change is expected): ext/standard/array.c ext /standard/tests/array/array_multisort_variation7.phpt ext/standard/tests/array/array_multisort_variation8. phpt ext/standard/tests/array/array_multisort_variation 9.phpt |
||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-92633@lists.php.net to get a copy of this message | ||
Commit: eb65db08081385a7a182abc3561c13f514dd6748
Author: Xinchen Hui <laruence@gmail.com> Thu, 23 Jun 2016 20:58:45 +0800
Parents: f0bbc230f7ad131924d1dd67ba8ccc19bb3b9382
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=eb65db08081385a7a182abc3561c13f514dd6748
Log:
Use zend_sort in array_multisort (tests change is expected)
Changed paths:
M ext/standard/array.c
M ext/standard/tests/array/array_multisort_variation7.phpt
M ext/standard/tests/array/array_multisort_variation8.phpt
M ext/standard/tests/array/array_multisort_variation9.phpt
Diff:
diff --git a/ext/standard/array.c b/ext/standard/array.c
index 4dba1a1..ddfce76 100644
--- a/ext/standard/array.c
+++ b/ext/standard/array.c
@@ -4989,7 +4989,7 @@ PHP_FUNCTION(array_multisort)
}
/* Do the actual sort magic - bada-bim, bada-boom. */
- zend_qsort(indirect, array_size, sizeof(Bucket *), php_multisort_compare,
(swap_func_t)array_bucket_p_sawp);
+ zend_sort(indirect, array_size, sizeof(Bucket *), php_multisort_compare,
(swap_func_t)array_bucket_p_sawp);
/* Restructure the arrays based on sorted indirect - this is mostly taken from zend_hash_sort()
function. */
for (i = 0; i < num_arrays; i++) {
diff --git a/ext/standard/tests/array/array_multisort_variation7.phpt
b/ext/standard/tests/array/array_multisort_variation7.phpt
index 4e9feb5..10980be 100644
--- a/ext/standard/tests/array/array_multisort_variation7.phpt
+++ b/ext/standard/tests/array/array_multisort_variation7.phpt
@@ -41,28 +41,28 @@ var_dump($inputs);
*** Testing array_multisort() : usage variation - test sort order of all types***
bool(true)
array(10) {
- ["empty string DQ"]=>
- string(0) ""
+ ["float -10.5"]=>
+ float(-10.5)
["int 0"]=>
int(0)
+ [0]=>
+ array(0) {
+ }
["uppercase NULL"]=>
NULL
+ ["empty string DQ"]=>
+ string(0) ""
["undefined var"]=>
NULL
- [0]=>
- array(0) {
- }
+ ["lowercase true"]=>
+ bool(true)
["instance of classWithToString"]=>
object(classWithToString)#1 (0) {
}
+ ["string DQ"]=>
+ string(6) "string"
["instance of classWithoutToString"]=>
object(classWithoutToString)#2 (0) {
}
- ["lowercase true"]=>
- bool(true)
- ["float -10.5"]=>
- float(-10.5)
- ["string DQ"]=>
- string(6) "string"
}
===DONE===
diff --git a/ext/standard/tests/array/array_multisort_variation8.phpt
b/ext/standard/tests/array/array_multisort_variation8.phpt
index 1995ee8..6b50e0e 100644
--- a/ext/standard/tests/array/array_multisort_variation8.phpt
+++ b/ext/standard/tests/array/array_multisort_variation8.phpt
@@ -47,15 +47,15 @@ var_dump($inputs);
*** Testing array_multisort() : usage variation - test sort order of all types***
bool(true)
array(10) {
- ["empty string DQ"]=>
- string(0) ""
["uppercase NULL"]=>
NULL
- ["undefined var"]=>
- NULL
+ ["empty string DQ"]=>
+ string(0) ""
["instance of classWithoutToString"]=>
object(classWithoutToString)#2 (0) {
}
+ ["undefined var"]=>
+ NULL
["float -10.5"]=>
float(-10.5)
["int 0"]=>
diff --git a/ext/standard/tests/array/array_multisort_variation9.phpt
b/ext/standard/tests/array/array_multisort_variation9.phpt
index eebd19f..cc4b8d1 100644
--- a/ext/standard/tests/array/array_multisort_variation9.phpt
+++ b/ext/standard/tests/array/array_multisort_variation9.phpt
@@ -42,9 +42,7 @@ var_dump($inputs);
Notice: Object of class classWithToString could not be converted to float in
%sarray_multisort_variation9.php on line %d
-Notice: Object of class classWithoutToString could not be converted to float in
%sarray_multisort_variation9.php on line %d
-
-Notice: Object of class classWithoutToString could not be converted to float in
%sarray_multisort_variation9.php on line %d
+Notice: Object of class classWithToString could not be converted to float in
%sarray_multisort_variation9.php on line %d
Notice: Object of class classWithoutToString could not be converted to float in
%sarray_multisort_variation9.php on line %d
@@ -53,26 +51,26 @@ bool(true)
array(10) {
["float -10.5"]=>
float(-10.5)
- ["string DQ"]=>
- string(6) "string"
- ["undefined var"]=>
- NULL
- ["empty string DQ"]=>
- string(0) ""
- ["uppercase NULL"]=>
- NULL
["int 0"]=>
int(0)
[0]=>
array(0) {
}
- ["instance of classWithoutToString"]=>
- object(classWithoutToString)#2 (0) {
- }
+ ["uppercase NULL"]=>
+ NULL
+ ["empty string DQ"]=>
+ string(0) ""
+ ["string DQ"]=>
+ string(6) "string"
+ ["undefined var"]=>
+ NULL
["lowercase true"]=>
bool(true)
["instance of classWithToString"]=>
object(classWithToString)#1 (0) {
}
+ ["instance of classWithoutToString"]=>
+ object(classWithoutToString)#2 (0) {
+ }
}
-===DONE===
\ No newline at end of file
+===DONE===