Skip to content

Add Symfony 6.4 compatibility (dual 5.4 + 6.4)#3

Open
AymericPlanche wants to merge 1 commit intomasterfrom
symfony-6.4-compat
Open

Add Symfony 6.4 compatibility (dual 5.4 + 6.4)#3
AymericPlanche wants to merge 1 commit intomasterfrom
symfony-6.4-compat

Conversation

@AymericPlanche
Copy link
Copy Markdown

Summary

  • Bump symfony/* constraints from ^4.4 || ^5.1 to ^5.4 || ^6.4
  • Add symfony/password-hasher dependency (replaces removed encoder on 6.x)
  • Add polyfills for SecurityFactoryInterface and PassportInterface (removed in Symfony 6.0)
  • Split security.xml: legacy provider+listener in security_legacy.xml, loaded only on 5.x
  • Add PasswordHasherCompilerPass to rewire encoder → hasher on 6.x
  • OAuthStorage: dual encoder/hasher support, loadUserByIdentifier/loadUserByUsername fallback
  • OAuthFactory: add getPriority() for 6.x authenticator factory
  • FOSOAuthServerBundle: conditional addAuthenticatorFactory() / addSecurityListenerFactory()

Why

Akeneo PIM is upgrading from Symfony 5.4 to 6.4. This bundle's constraints (^4.4 || ^5.1) are a hard blocker. The dual-compat approach allows merging now while still running on 5.4, then switching to 6.4 once all dependencies are ready.

The runtime shim pattern (interface_exists, method_exists) is standard practice — used by friendsofsymfony/rest-bundle, doctrine/doctrine-bundle, and others for multi-Symfony support.

Testing

Tested on Akeneo PIM (Symfony 5.4):

  • Container compiles (cache:clear on dev + test)
  • Password grant: GetAccessTokenIntegration — 13 tests, 54 assertions
  • Refresh token: RefreshTokenIntegration — 4 tests, 28 assertions
  • Auth security E2E: CheckAuthenticationSecurityEndToEnd — 6 tests, 27 assertions
  • Apps OAuth E2E: RequestAccessTokenActionEndToEnd — 3 tests, 22 assertions
  • Manual API testing via curl (token grant + authenticated API call)

- Bump symfony/* constraints to ^5.4 || ^6.4, php to ^8.1
- Add symfony/password-hasher to require
- Add polyfills for SecurityFactoryInterface and PassportInterface
  removed in Symfony 6.0 (Compat/ directory, loaded via composer files)
- Split security.xml: legacy provider+listener moved to security_legacy.xml,
  loaded only on Symfony 5.x (where SecurityFactoryInterface exists)
- FOSOAuthServerBundle: conditionally call addAuthenticatorFactory() (6.x)
  or addSecurityListenerFactory() (5.x)
- Add PasswordHasherCompilerPass: rewires OAuthStorage to use
  security.user_password_hasher on Symfony 6.x
- OAuthStorage: accept both EncoderFactory (5.x) and UserPasswordHasher (6.x),
  support both loadUserByIdentifier (6.x) and loadUserByUsername (5.x)
- OAuthFactory: add getPriority() required by AuthenticatorFactoryInterface in 6.x
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant