Skip to content

Commit

Permalink
0.99.4
Browse files Browse the repository at this point in the history
- Pre 1.0 release, compatible only with PHP8+
- fix null arg at non-null call (`onLoginSuccessful`)
  • Loading branch information
Karel Wintersky committed Sep 5, 2024
1 parent 5aab775 commit 97a7db3
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/Auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ private function processRememberDirective()
// the cookie and its contents have now been proven to be valid
$valid = true;

$this->onLoginSuccessful($rememberData['user'], $rememberData['email'], $rememberData['username'], $rememberData['status'], $rememberData['roles_mask'], $rememberData['force_logout'], true);
$this->onLoginSuccessful($rememberData['user'], $rememberData['email'] ?? '', $rememberData['username'] ?? '', $rememberData['status'], $rememberData['roles_mask'], $rememberData['force_logout'], true);
}
}
}
Expand Down Expand Up @@ -274,7 +274,7 @@ protected function onLoginSuccessful(int $userId, string $email, string $usernam
throw new DatabaseError($e->getMessage());
}

parent::onLoginSuccessful($userId, $email, $username, $status, $roles, $forceLogout, $remembered);
parent::onLoginSuccessful($userId, $email ?? '', $username ?? '', $status, $roles, $forceLogout, $remembered);
}

/**
Expand Down Expand Up @@ -754,7 +754,7 @@ private function authenticateUserInternal(string $password, ?string $email = nul

if ((int)$userData['verified'] === 1) {
if (!isset($onBeforeSuccess) || (\is_callable($onBeforeSuccess) && $onBeforeSuccess($userData['id']) === true)) {
$this->onLoginSuccessful($userData['id'], $userData['email'], $userData['username'], $userData['status'], $userData['roles_mask'], $userData['force_logout'], false);
$this->onLoginSuccessful($userData['id'], $userData['email'] ?? '', $userData['username'] ?? '', $userData['status'], $userData['roles_mask'], $userData['force_logout'], false);

// continue to support the old parameter format
if ($rememberDuration === true) {
Expand Down Expand Up @@ -970,7 +970,7 @@ public function confirmEmailAndSignIn(string $selector, string $token, ?int $rem
['id', 'email', 'username', 'status', 'roles_mask', 'force_logout']
);

$this->onLoginSuccessful($userData['id'], $userData['email'], $userData['username'], $userData['status'], $userData['roles_mask'], $userData['force_logout'], true);
$this->onLoginSuccessful($userData['id'], $userData['email'] ?? '', $userData['username'] ?? '', $userData['status'], $userData['roles_mask'], $userData['force_logout'], true);

if ($rememberDuration !== null) {
$this->createRememberDirective($userData['id'], $rememberDuration);
Expand Down Expand Up @@ -1586,7 +1586,7 @@ public function resetPasswordAndSignIn(string $selector, string $token, string $
['username', 'status', 'roles_mask', 'force_logout']
);

$this->onLoginSuccessful($idAndEmail['id'], $idAndEmail['email'], $userData['username'], $userData['status'], $userData['roles_mask'], $userData['force_logout'], true);
$this->onLoginSuccessful($idAndEmail['id'], $idAndEmail['email'] ?? '', $userData['username'] ?? '', $userData['status'], $userData['roles_mask'], $userData['force_logout'], true);

if ($rememberDuration !== null) {
$this->createRememberDirective($idAndEmail['id'], $rememberDuration);
Expand Down

0 comments on commit 97a7db3

Please sign in to comment.