|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #79868 Sorting with array_unique gives unwanted result
Submitted: 2020-07-17 15:22 UTC Modified: 2020-07-19 10:01 UTC
From: dries at vints dot io Assigned: nikic (profile)
Status: Closed Package: *General Issues
PHP Version: 8.0.0alpha2 OS: macOS Catalina 10.15.5
Private report: No CVE-ID: None
 [2020-07-17 15:22 UTC] dries at vints dot io
Sorting with array_unique returns different results than in previous PHP versions. I suspect this is because of

If you run the test script from below it'll return the result seeing in

Test script:

Expected result:
array(2) {
  string(48) "Illuminate\Routing\Middleware\SubstituteBindings"
  string(46) "Illuminate\Auth\Middleware\Authorize:edit,post"

Actual result:
array(2) {
  string(46) "Illuminate\Auth\Middleware\Authorize:edit,post"
  string(48) "Illuminate\Routing\Middleware\SubstituteBindings"


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2020-07-18 11:26 UTC]
-Status: Open +Status: Feedback -Assigned To: +Assigned To: sjon
 [2020-07-18 11:26 UTC]
can you explain why "Illuminate\Routing" should be sorted before "Illuminate\Auth" ?
 [2020-07-18 16:37 UTC] dries at vints dot io
-Status: Feedback +Status: Assigned
 [2020-07-18 16:37 UTC] dries at vints dot io
@sjon I can't, I don't dispute the new behavior makes more sense. This was a side effect we didn't forsee. I'm reporting this as a change in behavior after Nikita confirmed this wasn't suppose to change:
 [2020-07-19 09:56 UTC]
-Status: Assigned +Status: Verified -Assigned To: sjon +Assigned To: nikic
 [2020-07-19 10:01 UTC] dries at vints dot io
Just to be fully clear: we've already worked around this by writing our own sorting function. If you decided that this is indeed the intended behavior then that would be alright with us.
 [2020-07-20 13:17 UTC]
Automatic comment on behalf of
Log: Fix bug #79868
 [2020-07-20 13:17 UTC]
-Status: Verified +Status: Closed
 [2020-07-23 12:24 UTC] dries at vints dot io
Thanks Nikita!
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat May 18 05:01:31 2024 UTC