Skip to content

Commit 1663784

Browse files
committed
bug symfony#48554 [Security] Fix invalid deprecation messages in Security constants (IonBazan)
This PR was merged into the 6.2 branch. Discussion ---------- [Security] Fix invalid deprecation messages in Security constants | Q | A | ------------- | --- | Branch? | 6.2 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | - | License | MIT | Doc PR | - This PR changes invalid deprecation message, suggesting to use `\Symfony\Bundle\SecurityBundle\Security::ACCESS_DENIED_ERROR` instead of `\Symfony\Component\Security\Core\Security::ACCESS_DENIED_ERROR`, while `\Symfony\Component\Security\Http\SecurityRequestAttributes::ACCESS_DENIED_ERROR` should be used. For reference: symfony#47760 Commits ------- 3fd5a40 Point `Security::*` constants to `SecurityRequestAttributes::*` ones
2 parents beaef9e + 3fd5a40 commit 1663784

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

src/Symfony/Bundle/SecurityBundle/Security.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
use Symfony\Component\Security\Http\Authenticator\AuthenticatorInterface;
2525
use Symfony\Component\Security\Http\Event\LogoutEvent;
2626
use Symfony\Component\Security\Http\ParameterBagUtils;
27+
use Symfony\Component\Security\Http\SecurityRequestAttributes;
2728
use Symfony\Contracts\Service\ServiceProviderInterface;
2829

2930
/**
@@ -37,6 +38,10 @@
3738
*/
3839
class Security extends LegacySecurity
3940
{
41+
public const ACCESS_DENIED_ERROR = SecurityRequestAttributes::ACCESS_DENIED_ERROR;
42+
public const AUTHENTICATION_ERROR = SecurityRequestAttributes::AUTHENTICATION_ERROR;
43+
public const LAST_USERNAME = SecurityRequestAttributes::LAST_USERNAME;
44+
4045
public function __construct(private readonly ContainerInterface $container, private readonly array $authenticators = [])
4146
{
4247
parent::__construct($container, false);

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

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,22 +26,16 @@ class Security implements AuthorizationCheckerInterface
2626
{
2727
/**
2828
* @deprecated since Symfony 6.2, use \Symfony\Bundle\SecurityBundle\Security::ACCESS_DENIED_ERROR instead
29-
*
30-
* In 7.0, move this constant to the NewSecurityHelper class and make it reference SecurityRequestAttributes::ACCESS_DENIED_ERROR.
3129
*/
3230
public const ACCESS_DENIED_ERROR = '_security.403_error';
3331

3432
/**
3533
* @deprecated since Symfony 6.2, use \Symfony\Bundle\SecurityBundle\Security::AUTHENTICATION_ERROR instead
36-
*
37-
* In 7.0, move this constant to the NewSecurityHelper class and make it reference SecurityRequestAttributes::AUTHENTICATION_ERROR.
3834
*/
3935
public const AUTHENTICATION_ERROR = '_security.last_error';
4036

4137
/**
4238
* @deprecated since Symfony 6.2, use \Symfony\Bundle\SecurityBundle\Security::LAST_USERNAME instead
43-
*
44-
* In 7.0, move this constant to the NewSecurityHelper class and make it reference SecurityRequestAttributes::LAST_USERNAME.
4539
*/
4640
public const LAST_USERNAME = '_security.last_username';
4741

0 commit comments

Comments
 (0)