I'm in way beyond my depth as far as PHP knowledge here, but I was able to trace the code to the point where ajax.users.php, in the function searchStaff() has a line that says:
foreach (AuthenticationBackend::getSearchDirectories() as $ab) {
foreach ($ab->search($_REQUEST['q']) as $u)
$users[] = $u;
}
I modified that to put 'echo("<pre>"); print_r($ab); echo("</pre>")' after the first foreach statement to see if it would show anything useful. When I went to "http://myserver/osticket/scp/ajax.php/users/staff?q=alan" in a browser, I got two different outputs depending on whether I was running under PHP 8.0 or 8.1. I can match up many of the elements between the two outputs, but they are in a completely different order and some lines in the working one don't appear anywhere in the non-working (PHP 8.1) output.
I was thinking that this points to something in the LDAP plugin being handled differently between the two PHP versions. I found this: https://php.watch/versions/8.1/LDAP-resource which says:
I see that inside the auth-ldap.phar plugin file there are multiple examples of "if (is_resource...)" used. Could that be the source of the problem? Again - I'm stretching way beyond my knowledge level on PHP here, so apologies in advance if I'm not making much sense.