Bug #81024 [NEW]: The uasort / uksort function does not work correctly
| From: | ermolaev-nv at ro dot ru | Date: | Sun, 09 May 2021 22:05:48 +0000 |
| Subject: | Bug #81024 [NEW]: The uasort / uksort function does not work correctly | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-233756@lists.php.net to get a copy of this message | ||
From: ermolaev-nv at ro dot ru
Operating system: Docker php:8.0.6-cli-alpine3.12
PHP version: 8.0.6
Package: *General Issues
Bug Type: Bug
Bug description:The uasort / uksort function does not work correctly
Description:
------------
The uasort / uksort function does not work correctly
Test script:
---------------
<?php
$ar = [
[393, 464],
[-59, 180],
[-342, 402],
[-90, 135],
[-302, 207],
];
uasort($ar, static fn($a, $b) : int => $a[0] > $b[0]);
var_dump($ar);
Expected result:
----------------
array(5) {
[2]=>
array(2) {
[0]=>
int(-342)
[1]=>
int(402)
}
[4]=>
array(2) {
[0]=>
int(-302)
[1]=>
int(207)
}
[3]=>
array(2) {
[0]=>
int(-90)
[1]=>
int(135)
}
[1]=>
array(2) {
[0]=>
int(-59)
[1]=>
int(180)
}
[0]=>
array(2) {
[0]=>
int(393)
[1]=>
int(464)
}
}
Actual result:
--------------
array(5) {
[1]=>
array(2) {
[0]=>
int(-59)
[1]=>
int(180)
}
[2]=>
array(2) {
[0]=>
int(-342)
[1]=>
int(402)
}
[4]=>
array(2) {
[0]=>
int(-302)
[1]=>
int(207)
}
[3]=>
array(2) {
[0]=>
int(-90)
[1]=>
int(135)
}
[0]=>
array(2) {
[0]=>
int(393)
[1]=>
int(464)
}
}
--
Edit bug report at https://bugs.php.net/bug.php?id=81024&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=81024&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=81024&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=81024&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=81024&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=81024&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=81024&r=support
Expected behavior: https://bugs.php.net/fix.php?id=81024&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=81024&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=81024&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=81024&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=81024&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=81024&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=81024&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=81024&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=81024&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=81024&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=81024&r=mysqlcfg