Skip to content

Commit 2624ff0

Browse files
authored
Remove error_handling(0) calls in auth code (librenms#17281)
Legacy authenticators should be clean by now thanks to phpstan
1 parent 2faf78a commit 2624ff0

File tree

1 file changed

+0
-14
lines changed

1 file changed

+0
-14
lines changed

app/Providers/LegacyUserProvider.php

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,7 @@ public function retrieveById($identifier)
5757
*/
5858
public function retrieveByLegacyId($identifier)
5959
{
60-
error_reporting(0);
6160
$legacy_user = LegacyAuth::get()->getUser($identifier);
62-
error_reporting(-1);
6361

6462
return $this->retrieveByCredentials(['username' => $legacy_user['username'] ?? null]);
6563
}
@@ -116,8 +114,6 @@ public function updateRememberToken(Authenticatable $user, $token): void
116114
*/
117115
public function validateCredentials(Authenticatable $user, array $credentials)
118116
{
119-
error_reporting(0);
120-
121117
$authorizer = LegacyAuth::get();
122118

123119
try {
@@ -141,8 +137,6 @@ public function validateCredentials(Authenticatable $user, array $credentials)
141137
$username = $username ?? Session::get('username', $credentials['username']);
142138

143139
DB::table('authlog')->insert(['user' => $username, 'address' => Request::ip(), 'result' => $auth_message]);
144-
} finally {
145-
error_reporting(-1);
146140
}
147141

148142
return false;
@@ -156,8 +150,6 @@ public function validateCredentials(Authenticatable $user, array $credentials)
156150
*/
157151
public function retrieveByCredentials(array $credentials)
158152
{
159-
error_reporting(0);
160-
161153
$auth = LegacyAuth::get();
162154
$type = LegacyAuth::getType();
163155

@@ -170,18 +162,12 @@ public function retrieveByCredentials(array $credentials)
170162
$auth_id = $auth->getUserid($username);
171163
$new_user = $auth->getUser($auth_id);
172164

173-
error_reporting(-1);
174-
175165
if (empty($new_user)) {
176166
// some legacy auth create users in the authenticate method, if it doesn't exist yet, lets try authenticate (Laravel calls retrieveByCredentials first)
177167
try {
178-
error_reporting(0);
179-
180168
$auth->authenticate($credentials);
181169
$auth_id = $auth->getUserid($username);
182170
$new_user = $auth->getUser($auth_id);
183-
184-
error_reporting(-1);
185171
} catch (AuthenticationException $ae) {
186172
toast()->error($ae->getMessage());
187173
}

0 commit comments

Comments
 (0)