Skip to content

Conversation

@arshidkv12
Copy link
Contributor

The array_unique() now validates the sort_type argument and throws ValueError when an unsupported value is provided.

@iluuu1994 iluuu1994 requested a review from Girgias February 2, 2026 15:30
Copy link
Member

@iluuu1994 iluuu1994 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like this is also missing handling for SORT_FLAG_CASE, which looks to be untested. https://3v4l.org/dqSln This is just from a very quick look, there might be other issues.

Copy link
Member

@iluuu1994 iluuu1994 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Marking as "Request changes" for visibility.

arshidkv12 and others added 3 commits February 2, 2026 21:10
Co-authored-by: Ilija Tovilo <ilija.tovilo@me.com>
Co-authored-by: Ilija Tovilo <ilija.tovilo@me.com>
@arshidkv12
Copy link
Contributor Author

It looks like this is also missing handling for SORT_FLAG_CASE, which looks to be untested. https://3v4l.org/dqSln This is just from a very quick look, there might be other issues.

I don’t see SORT_FLAG_CASE on https://www.php.net/manual/en/function.array-unique.php.

@iluuu1994
Copy link
Member

It's not documented, but it's there, as demonstrated by the 3v4l.

@arshidkv12 arshidkv12 requested a review from iluuu1994 February 2, 2026 16:44
Copy link
Member

@iluuu1994 iluuu1994 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's all the issues I could find. Please somebody else verify. I'm not code owner.

if (base_sort != PHP_SORT_REGULAR
&& base_sort != PHP_SORT_NUMERIC
&& base_sort != PHP_SORT_STRING
&& base_sort != PHP_SORT_LOCALE_STRING) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's also SORT_NATURAL. I don't know whether it would differ in behavior from SORT_STRING, but even if it doesn't it should continue to be accepted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants