Skip to content

Commit b90664b

Browse files
minor symfony#35472 [Security] Improved error message when no supported user provider is found (wouterj)
This PR was submitted for the 4.4 branch but it was merged into the 3.4 branch instead. Discussion ---------- [Security] Improved error message when no supported user provider is found | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | no | New feature? | no | Deprecations? | no | Tickets | Fix symfony#35435 | License | MIT | Doc PR | - Commits ------- 6b2db6d Improved error message when no supported user provider is found
2 parents d90a503 + 6b2db6d commit b90664b

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

src/Symfony/Component/Security/Core/User/ChainUserProvider.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ public function refreshUser(UserInterface $user)
9191
$e->setUsername($user->getUsername());
9292
throw $e;
9393
} else {
94-
throw new UnsupportedUserException(sprintf('The account "%s" is not supported.', \get_class($user)));
94+
throw new UnsupportedUserException(sprintf('There is no user provider for user "%s". Shouldn\'t the "supportsClass()" method of your user provider return true for this classname?', \get_class($user)));
9595
}
9696
}
9797

src/Symfony/Component/Security/Http/Firewall/ContextListener.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ protected function refreshUser(TokenInterface $token)
238238
return null;
239239
}
240240

241-
throw new \RuntimeException(sprintf('There is no user provider for user "%s".', $userClass));
241+
throw new \RuntimeException(sprintf('There is no user provider for user "%s". Shouldn\'t the "supportsClass()" method of your user provider return true for this classname?', $userClass));
242242
}
243243

244244
private function safelyUnserialize($serializedToken)

src/Symfony/Component/Security/Http/RememberMe/AbstractRememberMeServices.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ final protected function getUserProvider($class)
239239
}
240240
}
241241

242-
throw new UnsupportedUserException(sprintf('There is no user provider that supports class "%s".', $class));
242+
throw new UnsupportedUserException(sprintf('There is no user provider for user "%s". Shouldn\'t the "supportsClass()" method of your user provider return true for this classname?', $class));
243243
}
244244

245245
/**

0 commit comments

Comments
 (0)