File tree Expand file tree Collapse file tree 3 files changed +21
-0
lines changed Expand file tree Collapse file tree 3 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -60,6 +60,8 @@ PHP NEWS
60
60
. Fixed bug GH-19701 (Serialize/deserialize loses some data). (nielsdos)
61
61
. Fixed bug GH-19801 (leaks in var_dump() and debug_zval_dump()).
62
62
(alexandre-daubois)
63
+ . Fixed bug GH-20043 (array_unique assertion failure with RC1 array
64
+ causing an exception on sort). (nielsdos)
63
65
64
66
- Streams:
65
67
. Fixed bug GH-19248 (Use strerror_r instead of strerror in main).
Original file line number Diff line number Diff line change @@ -5027,6 +5027,11 @@ PHP_FUNCTION(array_unique)
5027
5027
ZVAL_UNDEF (& arTmp [i ].b .val );
5028
5028
zend_sort ((void * ) arTmp , i , sizeof (struct bucketindex ),
5029
5029
(compare_func_t ) cmp , (swap_func_t ) array_bucketindex_swap );
5030
+
5031
+ if (UNEXPECTED (EG (exception ))) {
5032
+ goto out ;
5033
+ }
5034
+
5030
5035
/* go through the sorted array and delete duplicates from the copy */
5031
5036
lastkept = arTmp ;
5032
5037
for (cmpdata = arTmp + 1 ; Z_TYPE (cmpdata -> b .val ) != IS_UNDEF ; cmpdata ++ ) {
@@ -5046,6 +5051,8 @@ PHP_FUNCTION(array_unique)
5046
5051
}
5047
5052
}
5048
5053
}
5054
+
5055
+ out :
5049
5056
pefree (arTmp , GC_FLAGS (Z_ARRVAL_P (array )) & IS_ARRAY_PERSISTENT );
5050
5057
5051
5058
if (in_place ) {
Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ GH-20043 (array_unique assertion failure with RC1 array causing an exception on sort)
3
+ --FILE--
4
+ <?php
5
+ try {
6
+ array_unique ([new stdClass , new stdClass ], SORT_STRING | SORT_FLAG_CASE );
7
+ } catch (Error $ e ) {
8
+ echo $ e ->getMessage ();
9
+ }
10
+ ?>
11
+ --EXPECT--
12
+ Object of class stdClass could not be converted to string
You can’t perform that action at this time.
0 commit comments