Replies: 1 comment 3 replies
-
| Question is why is Laravel using 
 UPDATE But a simple online search reveals: 
 | 
Beta Was this translation helpful? Give feedback.
-
| Question is why is Laravel using 
 UPDATE But a simple online search reveals: 
 | 
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Many of you may be blissfully unaware, but PHP's
SORT_REGULARis fundamentally flawed and leads to unpredictable results, especially when used witharray_unique()as it's currently implemented inCollection->unique().I submitted a PR to the Laravel framework with a partial attempt to fix the issue. After much consideration, I feel we need to take
SORT_REGULARbehind the woodshed and accept correctness over micro optimization. But we don't have to revert to the originalin_array-- there are better solutions.If we all prefer to be typestict for
Collection->unique()by default, we can be both fast and correct. The alternative, is a little slowdown by default (non-typestrict by default), but correct, as opposed to the current fast and mostly kinda correct.See: #57480
Also see my new PR that at least gives us a performant solution for us who can't accept
SORT_REGULAR: #575173 votes ·
Beta Was this translation helpful? Give feedback.
All reactions