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
, useCouchbaseCollectionAdapter
with 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
ProxyCacheWarmer
asfinal
-
Deprecate passing
null
as the allowed variable names toExpressionLanguage::lint()
andParser::lint()
, pass theIGNORE_UNKNOWN_VARIABLES
flag 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_protocol
option of theUrlType
, it will default tonull
in 8.0 (the current default is'http'
)
- [BC BREAK] Enabling
framework.rate_limiter
requiressymfony/rate-limiter
7.1 or higher - Mark classes
ConfigBuilderCacheWarmer
,Router
,SerializerCacheWarmer
,TranslationsCacheWarmer
,Translator
andValidatorCacheWarmer
asfinal
- Deprecate the
router.cache_dir
config option, the Router will always use thekernel.build_dir
parameter - Reset env vars when resetting the container
-
Deprecate the
setLogger()
methods of theNoPrivateNetworkHttpClient
,TraceableHttpClient
andScopingHttpClient
classes, 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
Extension
class is marked as internal, extend theExtension
class from the DependencyInjection component instead - Deprecate
Extension::addAnnotatedClassesToCompile()
- Deprecate
AddAnnotatedClassesToCachePass
- Deprecate the
setAnnotatedClassCache()
andgetAnnotatedClassesToCompile()
methods of theKernel
class - Deprecate the
addAnnotatedClassesToCompile()
andgetAnnotatedClassesToCompile()
methods of theExtension
class
- [BC BREAK] Extracted
EmojiTransliterator
to a separatesymfony/emoji
component, the new FQCN isSymfony\Component\Emoji\EmojiTransliterator
. You must install thesymfony/emoji
component if you're using the oldEmojiTransliterator
class in the Intl component.
- Postmark's "406 - Inactive recipient" API error code now results in a
PostmarkDeliveryEvent
instead of throwing aHttpTransportException
- Change the first and second argument of
OidcTokenHandler
toJose\Component\Core\AlgorithmManager
andJose\Component\Core\JWKSet
respectively
-
Mark class
ExpressionCacheWarmer
asfinal
-
Deprecate options
algorithm
andkey
ofoidc
token handler, usealgorithms
andkeyset
insteadBefore
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.jwk
service, usesecurity.access_token_handler.oidc.jwkset
instead
- Deprecate the
withDefaultContructorArguments()
method ofAbstractNormalizerContextBuilder
, usewithDefaultConstructorArguments()
instead (note the typo in the old method name)
- Mark class
DataCollectorTranslator
asfinal
- Mark class
TemplateCacheWarmer
asfinal
- Deprecate the
base_template_class
config option, this option is no-op when using Twig 3+
- Deprecate not passing a value for the
requireTld
option to theUrl
constraint (the default value will becometrue
in 8.0) - Deprecate
Bic::INVALID_BANK_CODE_ERROR
, as ISO 9362 defines no restrictions on BIC bank code characters
- Add method
getEnabledTransition()
toWorkflowInterface
- Add
$nbToken
argument toMarking::mark()
andMarking::unmark()