diff --git a/lib/Service/ProvisioningService.php b/lib/Service/ProvisioningService.php index 3dce2faeb..3fa319252 100644 --- a/lib/Service/ProvisioningService.php +++ b/lib/Service/ProvisioningService.php @@ -547,9 +547,16 @@ public function getSyncGroupsOfToken(int $providerId, object $idTokenPayload) { continue; } - if ($groupsWhitelistRegex && !preg_match($groupsWhitelistRegex, $group->gid)) { - $this->logger->debug('Skipped group `' . $group->gid . '` for importing as not part of whitelist'); - continue; + if ($groupsWhitelistRegex) { + $matchResult = preg_match($groupsWhitelistRegex, $group->gid); + if ($matchResult !== 1) { + if ($matchResult === 0) { + $this->logger->debug('Skipped group `' . $group->gid . '` for importing as not part of whitelist (not matching the regex)'); + } else { + $this->logger->debug('Skipped group `' . $group->gid . '` for importing as not part of whitelist (failure when matching)', ['match_result' => $matchResult]); + } + continue; + } } $group->gid = $this->idService->getId($providerId, $group->gid);