[php-src] Issue #21568: uasort() with 'strnatcasecmp' acts weird
[email protected] (staabm)
| Newsgroups | php.bugs |
|---|---|
| Message-ID | <[email protected]> |
Issue: https://github.com/php/php-src/issues/21568 Author: staabm ### Description we are in the process of covering the handling of `uasort` when using with `strnatcasecmp` and found a few things which we are not able to make sense of. I also looked thru the docs and did not find something which explained what we see. the proble occur arround strict-types and `Stringable` vs. `string` territory. especially interessting is that `strnatcasecmp` when invoked directly is happy with the given input, while using `strnatcasecmp` as callback via `uasort` errors. results vary with strict-types 0/1. see - https://3v4l.org/XgFEm#v8.3.30 (no error without declare) - https://3v4l.org/slZeW#v8.3.30 (strnatcasecmp error with declare strict=1) - https://3v4l.org/TdBcf#v8.3.30 (uasort doesn't error with declare strict=1) - https://3v4l.org/AAlUE#v8.3.30 (uasort via arrow-fn using strnatcasecmp()) so our questions mainly are - is all this expected behaviour? - can someone share some insights so we can properly reflect php-src runtime behaviour in PHPStan? thank you ### PHP Version ```plain PHP 8.3.x ``` ### Operating System _No response_