As mentioned in https://github.com/civicrm/civicrm-core/pull/22239#issuecomment-
997108926, there can be an exception:
```
Error: Call to a member function id() on bool in ...\CRM\Utils\System\Drupal8.php on line 359 #0 ...\ext\authx\Civi\Authx\Authenticator.php(380)
```
The function signature specifies `@return int|null`. Various callers appear to expect this, and that seems to be how it behaves on D7/WP.
* @return int|null
*/
public function getUfId($username) {
- if ($id = user_load_by_name($username)->id()) {
+ $user = user_load_by_name($username);
+ if ($user && $id = $user->id()) {
return $id;
}
}