[php-src] Issue #21568: uasort() with 'strnatcasecmp' acts weird

From: Date: Sat, 28 Mar 2026 16:01:21 +0000
Subject: [php-src] Issue #21568: uasort() with 'strnatcasecmp' acts weird
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-251863@lists.php.net to get a copy of this message
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_

« previous php.bugs (#251863) next »