Skip to content

Commit 6fe0fd0

Browse files
committed
standard: Validate sort_type argument in array_unique()
1 parent 927b9ee commit 6fe0fd0

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

ext/standard/array.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4863,6 +4863,18 @@ PHP_FUNCTION(array_unique)
48634863
return;
48644864
}
48654865

4866+
if (sort_type != PHP_SORT_REGULAR &&
4867+
sort_type != PHP_SORT_NUMERIC &&
4868+
sort_type != PHP_SORT_STRING &&
4869+
sort_type != PHP_SORT_LOCALE_STRING) {
4870+
4871+
zend_argument_value_error(
4872+
2,
4873+
"must be one of PHP_SORT_REGULAR, PHP_SORT_NUMERIC, PHP_SORT_STRING, or PHP_SORT_LOCALE_STRING"
4874+
);
4875+
RETURN_THROWS();
4876+
}
4877+
48664878
if (sort_type == PHP_SORT_STRING) {
48674879
HashTable seen;
48684880
zend_long num_key;

0 commit comments

Comments
 (0)