[php-src] Issue #8201: array_unique with SORT_REGULAR flag does not always work as expected
| From: | damianwadley | Date: | Tue, 15 Mar 2022 19:55:33 +0000 |
| Subject: | [php-src] Issue #8201: array_unique with SORT_REGULAR flag does not always work as expected | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-240349@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/8201
Comment Author: damianwadley
array_unique performs a sort and that means it's susceptible to the SORT_REGULAR problem (as
documented in [sort](https://www.php.net/manual/en/function.sort.php)):
> Warning
>
> Be careful when sorting arrays with mixed types values because sort() can produce unexpected
> results, if flags is SORT_REGULAR.
Here, the "mixed types" aren't strings versus numbers but strings vs _numeric
strings_. Because PHP compares numeric strings as if they were numbers.