Symfony 6.4 and Symfony 7.0 are released simultaneously at the end of November 2023. According to the Symfony
release process, both versions have the same features, but Symfony 6.4 doesn't include any significant backwards
compatibility changes.
Minor backwards 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.
Furthermore, Symfony 6.4 comes with a set of deprecation notices to help you prepare your code for Symfony 7.0. For the
full set of deprecations, see the UPGRADE-7.0.md file on the 7.0 branch.
Bundles
Bridges
Components
- BrowserKit
- Cache
- DependencyInjection
- DomCrawler
- ErrorHandler
- Form
- HttpFoundation
- HttpKernel
- Messenger
- RateLimiter
- Routing
- Security
- Serializer
- Templating
- Validator
- Workflow
- Add argument
$serverParameterstoAbstractBrowser::click()andAbstractBrowser::clickLink()
- [BC break]
EarlyExpirationHandlerno longer implementsMessageHandlerInterface, rely onAsMessageHandlerinstead
-
Deprecate
ContainerAwareInterfaceandContainerAwareTrait, use dependency injection insteadBefore
class MailingListService implements ContainerAwareInterface { use ContainerAwareTrait; public function sendMails() { $mailer = $this->container->get('mailer'); // ... } }
After
use Symfony\Component\Mailer\MailerInterface; class MailingListService { public function __construct( private MailerInterface $mailer, ) { } public function sendMails() { $mailer = $this->mailer; // ... } }
To fetch services lazily, you can use a service subscriber.
- [BC Break] Add return type-hints to
EntityFactory - Deprecate
DbalLogger, use a middleware instead - Deprecate not constructing
DoctrineDataCollectorwith an instance ofDebugDataHolder - Deprecate
DoctrineDataCollector::addLogger(), use aDebugDataHolderinstead - Deprecate
ContainerAwareLoader, use dependency injection in your fixtures instead - [BC Break] Change argument
$lastUsedofDoctrineTokenProvider::updateToken()to acceptDateTimeInterface
- Add argument
$defaulttoCrawler::attr()
- [BC break]
FlattenExceptionNormalizerno longer implementsContextAwareNormalizerInterface
- Deprecate using
DateTimeorDateTimeImmutablemodel data with a different timezone than configured with themodel_timezoneoption inDateType,DateTimeType, andTimeType - Deprecate
PostSetDataEvent::setData(), usePreSetDataEvent::setData()instead - Deprecate
PostSubmitEvent::setData(), usePreSubmitDataEvent::setData()orSubmitDataEvent::setData()instead
- [BC break] Add native return type to
Translatorand toApplication::reset() - Deprecate the integration of Doctrine annotations, either uninstall the
doctrine/annotationspackage or disable the integration by settingframework.annotationstofalse - Deprecate not setting some config options, their defaults will change in Symfony 7.0:
| option | default Symfony <7.0 | default in Symfony 7.0+ |
|---|---|---|
framework.http_method_override |
true |
false |
framework.handle_all_throwables |
false |
true |
framework.php_errors.log |
'%kernel.debug%' |
true |
framework.session.cookie_secure |
false |
'auto' |
framework.session.cookie_samesite |
null |
'lax' |
framework.session.handler_id |
'session.handler.native' |
null if save_path is not set, 'session.handler.native_file' otherwise |
framework.uid.default_uuid_version |
6 |
7 |
framework.uid.time_based_uuid_version |
6 |
7 |
framework.validation.email_validation_mode |
'loose' |
'html5' |
- Deprecate
framework.validation.enable_annotations, useframework.validation.enable_attributesinstead - Deprecate
framework.serializer.enable_annotations, useframework.serializer.enable_attributesinstead - Deprecate the
routing.loader.annotationservice, use therouting.loader.attributeservice instead - Deprecate the
routing.loader.annotation.directoryservice, use therouting.loader.attribute.directoryservice instead - Deprecate the
routing.loader.annotation.fileservice, use therouting.loader.attribute.fileservice instead - Deprecate
AnnotatedRouteControllerLoader, useAttributeRouteControllerLoaderinstead
- [BC break] Make
HeaderBag::getDate(),Response::getDate(),getExpires()andgetLastModified()return aDateTimeImmutable
- [BC break]
BundleInterfaceno longer extendsContainerAwareInterface - [BC break] Add native return types to
TraceableEventDispatcherand toMergeExtensionConfigurationPass - Deprecate
Kernel::stripComments() - Deprecate
UriSigner, useUriSignerfrom the HttpFoundation component instead - Deprecate
FileLinkFormatter, useFileLinkFormatterfrom the ErrorHandler component instead
- Deprecate
StopWorkerOnSignalsListenerin favor of using theSignalableCommandInterface - Deprecate
HandlerFailedException::getNestedExceptions(),HandlerFailedException::getNestedExceptionsOfClass()andDelayedMessageHandlingException::getExceptions()which are replaced by a newgetWrappedExceptions()method
- [BC break] Add native return type to
Logger::clear()and toDebugProcessor::clear()
- [BC break]
PsrServerRequestResolverno longer implementsArgumentValueResolverInterface
- Deprecate
SlidingWindow::getRetryAfter, useSlidingWindow::calculateTimeForTokensinstead
- [BC break] Add native return type to
AnnotationClassLoader::setResolver() - Deprecate Doctrine annotations support in favor of native attributes
- Deprecate passing an annotation reader as first argument to
AnnotationClassLoader(new signature:__construct(?string $env = null)) - Deprecate
AnnotationClassLoader, useAttributeClassLoaderinstead - Deprecate
AnnotationDirectoryLoader, useAttributeDirectoryLoaderinstead - Deprecate
AnnotationFileLoader, useAttributeFileLoaderinstead
- [BC break]
UserValueResolverno longer implementsArgumentValueResolverInterface - [BC break] Make
PersistentTokenimmutable - Deprecate accepting only
DateTimeforTokenProviderInterface::updateToken(), useDateTimeInterfaceinstead - Deprecate calling the constructor of
DefaultLoginRateLimiterwith an empty secret
- Deprecate the
require_previous_sessionconfig option. Setting it has no effect anymore
- Deprecate Doctrine annotations support in favor of native attributes
- Deprecate
AnnotationLoader, useAttributeLoaderinstead
- The component is deprecated and will be removed in 7.0, use Twig instead
- [BC Break] Add argument
$buildDirtoDataCollectorTranslator::warmUp()
- Deprecate Doctrine annotations support in favor of native attributes
- Deprecate
ValidatorBuilder::setDoctrineAnnotationReader() - Deprecate
ValidatorBuilder::addDefaultDoctrineAnnotationReader() - Deprecate
ValidatorBuilder::enableAnnotationMapping(), useValidatorBuilder::enableAttributeMapping()instead - Deprecate
ValidatorBuilder::disableAnnotationMapping(), useValidatorBuilder::disableAttributeMapping()instead - Deprecate
AnnotationLoader, useAttributeLoaderinstead
- Deprecate
GuardEvent::getContext()method that will be removed in 7.0