Title: uasort() with 'strnatcasecmp' acts weird · Issue #21568 · php/php-src · GitHub
Open Graph Title: uasort() with 'strnatcasecmp' acts weird · Issue #21568 · php/php-src
X Title: uasort() with 'strnatcasecmp' acts weird · Issue #21568 · php/php-src
Description: 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...
Open Graph Description: 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...
X Description: 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...
Opengraph URL: https://github.com/php/php-src/issues/21568
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"uasort() with 'strnatcasecmp' acts weird","articleBody":"### Description\n\nwe 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.\n\nthe problem occur arround strict-types and `Stringable` vs. `string` territory.\n\nespecially interessting is that `strnatcasecmp` when invoked directly behaves differently in comparison while using `strnatcasecmp` as callback via `uasort`. results vary with strict-types 0/1.\n\nsee\n- https://3v4l.org/XgFEm#v8.3.30 (no error without declare)\n- https://3v4l.org/slZeW#v8.3.30 (strnatcasecmp error with declare strict=1)\n- https://3v4l.org/TdBcf#v8.3.30 (uasort doesn't error with declare strict=1)\n- https://3v4l.org/AAlUE#v8.3.30 (uasort via arrow-fn using strnatcasecmp()) \n\nso our questions mainly are\n- is all this expected behaviour?\n- can someone share some insights so we can properly reflect php-src runtime behaviour in PHPStan?\n\nthank you\n\n### PHP Version\n\n```plain\nPHP 8.3.x\n```\n\n### Operating System\n\n_No response_","author":{"url":"https://github.com/staabm","@type":"Person","name":"staabm"},"datePublished":"2026-03-28T16:01:18Z","url":"https://github.com/php/php-src/issues/21568"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:6e2cac48-7c8c-c62f-88f4-bb50164509d1 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 975A:D0E46:AB758A:E3F002:6B00EB5A |
| html-safe-nonce | 1784a03d79c263fd4805b391119ea201afe1393d90067600b0b7ab110bb63ed4 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5NzVBOkQwRTQ2OkFCNzU4QTpFM0YwMDI6NkIwMEVCNUEiLCJ2aXNpdG9yX2lkIjoiNzk4OTUwMjY5NzAwNDkxOTY0MiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | eb46d7fcdd73835da41be4fe2150c1c93db339382a271553e4ba29a75a8a5ce5 |
| hovercard-subject-tag | issue:4160572242 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/php/php-src/21568/issue_layout |
| twitter:image | https://opengraph.githubassets.com/5875b0e53cffacb1ee55a0aab3877be779135256288b4170ca42388abe269219/php/php-src/issues/21568 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/5875b0e53cffacb1ee55a0aab3877be779135256288b4170ca42388abe269219/php/php-src/issues/21568 |
| og:image:alt | 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... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | staabm |
| hostname | github.com |
| expected-hostname | github.com |
| None | 4ef498cbabcbe3c50befc7a5b743e7072ee770b4daf0e15e54801180d1fa91fc |
| turbo-cache-control | no-preview |
| go-import | github.com/php/php-src git https://github.com/php/php-src.git |
| octolytics-dimension-user_id | 25158 |
| octolytics-dimension-user_login | php |
| octolytics-dimension-repository_id | 1903522 |
| octolytics-dimension-repository_nwo | php/php-src |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1903522 |
| octolytics-dimension-repository_network_root_nwo | php/php-src |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 9983dd5da06943f833c971dd5b6bc988e2858be5 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width