Trying to access array offset on value of type bool
I enabled the option to limit UNIX login to users in a specific UNIX (ie. "A group where the authorized NextCloud Users are") After doing so I am seeing the following error in my logs for all types users.
{"reqId":"lvI5vvuWiqACj9Tsq8LE","level":3,"time":"2024-03-10T02:03:47+00:00","remoteAddr":"192.168.0.72","user":"XXXXXXX","app":"PHP","method":"GET","url":"/ocs/v2.php/apps/notifications/api/v2/notifications?format=json","message":"Trying to access array offset on value of type bool at /usr/local/www/nextcloud/apps/user_pwauth/lib/UserPwauth.php#60","userAgent":"Mozilla/5.0 (FreeBSD) mirall/3.11.0git (Nextcloud, freebsd-13.2-RELEASE-p10 ClientArchitecture: x86_64 OsArchitecture: x86_64)","version":"28.0.1.1","data":{"app":"PHP"}}
This appears to be the code in question:
} else { //group variables is not empty so we’re getting the UID list from the group name
$list = posix_getgrnam($this->pwauth_group)['members'];
foreach($list as $entry) {
$r[] = posix_getpwnam($entry)['uid'];
}
}
So I am guessing that posix_getpwnam()
is somehow failing and returning a false
. My guess is that there is a member in the group for a user that doesn't exist (for whatever reason).
Maybe this would work instead?
foreach($list as $entry) {
$user_info = posix_getpwnam($entry);
if (!$user_info){ continue; }
$r[] = $user_info['uid'];
}
unset($user_info);
Edited by Daniel Morante