Skip to content

Commit

Permalink
Fix error with array_flip in AppleSignIn initialisation
Browse files Browse the repository at this point in the history
If AppleSignIn wasn't configured, it caused this error on startup:

  array_flip(): Can only flip STRING and INTEGER values!

remp/crm#2128
  • Loading branch information
tomaj authored and rootpd committed Nov 18, 2021
1 parent 8c9b55c commit f1c26ec
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/model/Auth/Sso/AppleSignIn.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class AppleSignIn

private $clientId;

private $trustedClientIds;
private $trustedClientIds = [];

private $configsRepository;

Expand All @@ -44,11 +44,17 @@ public function __construct(
User $user
) {
$this->clientId = $clientId;
$this->trustedClientIds = array_flip(array_merge([$clientId], array_filter($trustedClientIds)));
$this->configsRepository = $configsRepository;
$this->session = $session;
$this->ssoUserManager = $ssoUserManager;
$this->user = $user;

if ($clientId !== null) {
$this->trustedClientIds[$clientId] = true;
}
foreach (array_filter($trustedClientIds) as $trustedClientId) {
$this->trustedClientIds[$trustedClientId] = true;
}
}

public function isEnabled(): bool
Expand Down

0 comments on commit f1c26ec

Please sign in to comment.