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
$serverParameters
toAbstractBrowser::click()
andAbstractBrowser::clickLink()
- [BC break]
EarlyExpirationHandler
no longer implementsMessageHandlerInterface
, rely onAsMessageHandler
instead
-
Deprecate
ContainerAwareInterface
andContainerAwareTrait
, 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
DoctrineDataCollector
with an instance ofDebugDataHolder
- Deprecate
DoctrineDataCollector::addLogger()
, use aDebugDataHolder
instead - Deprecate
ContainerAwareLoader
, use dependency injection in your fixtures instead - [BC Break] Change argument
$lastUsed
ofDoctrineTokenProvider::updateToken()
to acceptDateTimeInterface
- Add argument
$default
toCrawler::attr()
- [BC break]
FlattenExceptionNormalizer
no longer implementsContextAwareNormalizerInterface
- Deprecate using
DateTime
orDateTimeImmutable
model data with a different timezone than configured with themodel_timezone
option inDateType
,DateTimeType
, andTimeType
- Deprecate
PostSetDataEvent::setData()
, usePreSetDataEvent::setData()
instead - Deprecate
PostSubmitEvent::setData()
, usePreSubmitDataEvent::setData()
orSubmitDataEvent::setData()
instead
- [BC break] Add native return type to
Translator
and toApplication::reset()
- Deprecate the integration of Doctrine annotations, either uninstall the
doctrine/annotations
package or disable the integration by settingframework.annotations
tofalse
- 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_attributes
instead - Deprecate
framework.serializer.enable_annotations
, useframework.serializer.enable_attributes
instead - Deprecate the
routing.loader.annotation
service, use therouting.loader.attribute
service instead - Deprecate the
routing.loader.annotation.directory
service, use therouting.loader.attribute.directory
service instead - Deprecate the
routing.loader.annotation.file
service, use therouting.loader.attribute.file
service instead - Deprecate
AnnotatedRouteControllerLoader
, useAttributeRouteControllerLoader
instead
- [BC break] Make
HeaderBag::getDate()
,Response::getDate()
,getExpires()
andgetLastModified()
return aDateTimeImmutable
- [BC break]
BundleInterface
no longer extendsContainerAwareInterface
- [BC break] Add native return types to
TraceableEventDispatcher
and toMergeExtensionConfigurationPass
- Deprecate
Kernel::stripComments()
- Deprecate
UriSigner
, useUriSigner
from the HttpFoundation component instead - Deprecate
FileLinkFormatter
, useFileLinkFormatter
from the ErrorHandler component instead
- Deprecate
StopWorkerOnSignalsListener
in 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]
PsrServerRequestResolver
no longer implementsArgumentValueResolverInterface
- Deprecate
SlidingWindow::getRetryAfter
, useSlidingWindow::calculateTimeForTokens
instead
- [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
, useAttributeClassLoader
instead - Deprecate
AnnotationDirectoryLoader
, useAttributeDirectoryLoader
instead - Deprecate
AnnotationFileLoader
, useAttributeFileLoader
instead
- [BC break]
UserValueResolver
no longer implementsArgumentValueResolverInterface
- [BC break] Make
PersistentToken
immutable - Deprecate accepting only
DateTime
forTokenProviderInterface::updateToken()
, useDateTimeInterface
instead - Deprecate calling the constructor of
DefaultLoginRateLimiter
with an empty secret
- Deprecate the
require_previous_session
config option. Setting it has no effect anymore
- Deprecate Doctrine annotations support in favor of native attributes
- Deprecate
AnnotationLoader
, useAttributeLoader
instead
- The component is deprecated and will be removed in 7.0, use Twig instead
- [BC Break] Add argument
$buildDir
toDataCollectorTranslator::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
, useAttributeLoader
instead
- Deprecate
GuardEvent::getContext()
method that will be removed in 7.0