Symfony 7.1 is a minor release. According to the Symfony release process, there should be no significant
backward compatibility breaks. Minor backward compatibility breaks are prefixed in this document with
[BC BREAK], make sure your code is compatible with these entries before upgrading.
Read more about this in the Symfony documentation.
If you're upgrading from a version below 7.0, follow the 7.0 upgrade guide first.
Bundles
Bridges
Components
- AssetMapper
- Cache
- DependencyInjection
- ExpressionLanguage
- Form
- Intl
- HttpClient
- HttpKernel
- Security
- Serializer
- Translation
- Workflow
- Deprecate
ImportMapConfigReader::splitPackageNameAndFilePath(), useImportMapEntry::splitPackageNameAndFilePath()instead
- Deprecate
CouchbaseBucketAdapter, useCouchbaseCollectionAdapterwith Couchbase 3 instead - The algorithm for the default cache namespace changed from SHA256 to XXH128
-
[BC BREAK] When used in the
prependExtension()method, theContainerConfigurator::import()method now prepends the configuration instead of appending it -
Deprecate
#[TaggedIterator]and#[TaggedLocator]attributes, use#[AutowireIterator]and#[AutowireLocator]insteadBefore
use Symfony\Component\DependencyInjection\Attribute\TaggedIterator; use Symfony\Component\DependencyInjection\Attribute\TaggedLocator; class HandlerCollection { public function __construct( #[TaggedIterator('app.handler', indexAttribute: 'key')] iterable $handlers, #[TaggedLocator('app.handler')] private ContainerInterface $locator, ) { } }
After
use Symfony\Component\DependencyInjection\Attribute\AutowireIterator; use Symfony\Component\DependencyInjection\Attribute\AutowireLocator; class HandlerCollection { public function __construct( #[AutowireIterator('app.handler', indexAttribute: 'key')] iterable $handlers, #[AutowireLocator('app.handler')] private ContainerInterface $locator, ) { } }
- Mark class
ProxyCacheWarmerasfinal
-
Deprecate passing
nullas the allowed variable names toExpressionLanguage::lint()andParser::lint(), pass theIGNORE_UNKNOWN_VARIABLESflag instead to ignore unknown variables during lintingBefore
$expressionLanguage->lint('a + 1', null);
After
use Symfony\Component\ExpressionLanguage\Parser; $expressionLanguage->lint('a + 1', [], Parser::IGNORE_UNKNOWN_VARIABLES);
- Deprecate not configuring the
default_protocoloption of theUrlType, it will default tonullin 8.0 (the current default is'http')
- [BC BREAK] Enabling
framework.rate_limiterrequiressymfony/rate-limiter7.1 or higher - Mark classes
ConfigBuilderCacheWarmer,Router,SerializerCacheWarmer,TranslationsCacheWarmer,TranslatorandValidatorCacheWarmerasfinal - Deprecate the
router.cache_dirconfig option, the Router will always use thekernel.build_dirparameter - Reset env vars when resetting the container
-
Deprecate the
setLogger()methods of theNoPrivateNetworkHttpClient,TraceableHttpClientandScopingHttpClientclasses, configure the logger of the wrapped clients directly insteadBefore
// ... use Symfony\Component\HttpClient\HttpClient; use Symfony\Component\HttpClient\NoPrivateNetworkHttpClient; $publicClient = new NoPrivateNetworkHttpClient(HttpClient::create()); $publicClient->setLogger(new Logger());
After
// ... use Symfony\Component\HttpClient\HttpClient; use Symfony\Component\HttpClient\NoPrivateNetworkHttpClient; $client = HttpClient::create(); $client->setLogger(new Logger()); $publicClient = new NoPrivateNetworkHttpClient($client);
- The
Extensionclass is marked as internal, extend theExtensionclass from the DependencyInjection component instead - Deprecate
Extension::addAnnotatedClassesToCompile() - Deprecate
AddAnnotatedClassesToCachePass - Deprecate the
setAnnotatedClassCache()andgetAnnotatedClassesToCompile()methods of theKernelclass - Deprecate the
addAnnotatedClassesToCompile()andgetAnnotatedClassesToCompile()methods of theExtensionclass
- [BC BREAK] Extracted
EmojiTransliteratorto a separatesymfony/emojicomponent, the new FQCN isSymfony\Component\Emoji\EmojiTransliterator. You must install thesymfony/emojicomponent if you're using the oldEmojiTransliteratorclass in the Intl component.
- Postmark's "406 - Inactive recipient" API error code now results in a
PostmarkDeliveryEventinstead of throwing aHttpTransportException
- Change the first and second argument of
OidcTokenHandlertoJose\Component\Core\AlgorithmManagerandJose\Component\Core\JWKSetrespectively
-
Mark class
ExpressionCacheWarmerasfinal -
Deprecate options
algorithmandkeyofoidctoken handler, usealgorithmsandkeysetinsteadBefore
security: firewalls: main: access_token: token_handler: oidc: algorithm: 'ES256' key: '{"kty":"...","k":"..."}' # ...
After
security: firewalls: main: access_token: token_handler: oidc: algorithms: ['ES256'] keyset: '{"keys":[{"kty":"...","k":"..."}]}' # ...
-
Deprecate the
security.access_token_handler.oidc.jwkservice, usesecurity.access_token_handler.oidc.jwksetinstead
- Deprecate the
withDefaultContructorArguments()method ofAbstractNormalizerContextBuilder, usewithDefaultConstructorArguments()instead (note the typo in the old method name)
- Mark class
DataCollectorTranslatorasfinal
- Mark class
TemplateCacheWarmerasfinal - Deprecate the
base_template_classconfig option, this option is no-op when using Twig 3+
- Deprecate not passing a value for the
requireTldoption to theUrlconstraint (the default value will becometruein 8.0) - Deprecate
Bic::INVALID_BANK_CODE_ERROR, as ISO 9362 defines no restrictions on BIC bank code characters
- Add method
getEnabledTransition()toWorkflowInterface - Add
$nbTokenargument toMarking::mark()andMarking::unmark()