Bug #79868 [NEW]: Sorting with array_unique gives unwanted result
| From: | dries at vints dot io | Date: | Fri, 17 Jul 2020 15:22:29 +0000 |
| Subject: | Bug #79868 [NEW]: Sorting with array_unique gives unwanted result | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-228103@lists.php.net to get a copy of this message | ||
From: dries at vints dot io
Operating system: macOS Catalina 10.15.5
PHP version: 8.0.0alpha2
Package: *General Issues
Bug Type: Bug
Bug description:Sorting with array_unique gives unwanted result
Description:
------------
Sorting with array_unique returns different results than in previous PHP
versions. I suspect this is because of
https://wiki.php.net/rfc/stable_sorting
If you run the test script from below it'll return the result seeing in
https://3v4l.org/9sbAq
Test script:
---------------
var_dump(array_unique([
'Illuminate\Routing\Middleware\SubstituteBindings',
'Illuminate\Auth\Middleware\Authorize:edit,post',
], SORT_REGULAR));
Expected result:
----------------
array(2) {
[0]=>
string(48) "Illuminate\Routing\Middleware\SubstituteBindings"
[1]=>
string(46) "Illuminate\Auth\Middleware\Authorize:edit,post"
}
Actual result:
--------------
array(2) {
[1]=>
string(46) "Illuminate\Auth\Middleware\Authorize:edit,post"
[0]=>
string(48) "Illuminate\Routing\Middleware\SubstituteBindings"
}
--
Edit bug report at https://bugs.php.net/bug.php?id=79868&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=79868&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=79868&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=79868&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=79868&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=79868&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=79868&r=support
Expected behavior: https://bugs.php.net/fix.php?id=79868&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=79868&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=79868&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=79868&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=79868&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=79868&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=79868&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=79868&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=79868&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=79868&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=79868&r=mysqlcfg