1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243
|
UPGRADE FROM 6.3 to 6.4
=======================
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](https://symfony.com/doc/6.4/setup/upgrade_minor.html).
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](https://github.com/symfony/symfony/blob/7.0/UPGRADE-7.0.md).
Table of Contents
-----------------
Bundles
* [FrameworkBundle](#FrameworkBundle)
* [SecurityBundle](#SecurityBundle)
Bridges
* [DoctrineBridge](#DoctrineBridge)
* [MonologBridge](#MonologBridge)
* [PsrHttpMessageBridge](#PsrHttpMessageBridge)
Components
* [BrowserKit](#BrowserKit)
* [Cache](#Cache)
* [DependencyInjection](#DependencyInjection)
* [DomCrawler](#DomCrawler)
* [ErrorHandler](#ErrorHandler)
* [Form](#Form)
* [HttpFoundation](#HttpFoundation)
* [HttpKernel](#HttpKernel)
* [Messenger](#Messenger)
* [RateLimiter](#RateLimiter)
* [Routing](#Routing)
* [Security](#Security)
* [Serializer](#Serializer)
* [Templating](#Templating)
* [Validator](#Validator)
* [VarExporter](#VarExporter)
* [Workflow](#Workflow)
BrowserKit
----------
* Add argument `$serverParameters` to `AbstractBrowser::click()` and `AbstractBrowser::clickLink()`
Cache
-----
* [BC break] `EarlyExpirationHandler` no longer implements `MessageHandlerInterface`, rely on `AsMessageHandler` instead
DependencyInjection
-------------------
* Deprecate `ContainerAwareInterface` and `ContainerAwareTrait`, use dependency injection instead
*Before*
```php
class MailingListService implements ContainerAwareInterface
{
use ContainerAwareTrait;
public function sendMails()
{
$mailer = $this->container->get('mailer');
// ...
}
}
```
*After*
```php
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](https://symfony.com/doc/6.4/service_container/service_subscribers_locators.html#defining-a-service-subscriber).
DoctrineBridge
--------------
* [BC Break] Add argument `$buildDir` to `ProxyCacheWarmer::warmUp()`
* [BC Break] Add return type-hints to `EntityFactory`
* Deprecate `DbalLogger`, use a middleware instead
* Deprecate not constructing `DoctrineDataCollector` with an instance of `DebugDataHolder`
* Deprecate `DoctrineDataCollector::addLogger()`, use a `DebugDataHolder` instead
* Deprecate `ContainerAwareLoader`, use dependency injection in your fixtures instead
* [BC Break] Change argument `$lastUsed` of `DoctrineTokenProvider::updateToken()` to accept `DateTimeInterface`
DomCrawler
----------
* Add argument `$default` to `Crawler::attr()`
ErrorHandler
------------
* [BC break] `FlattenExceptionNormalizer` no longer implements `ContextAwareNormalizerInterface`
Form
----
* Deprecate using `DateTime` or `DateTimeImmutable` model data with a different timezone than configured with the
`model_timezone` option in `DateType`, `DateTimeType`, and `TimeType`
* Deprecate `PostSetDataEvent::setData()`, use `PreSetDataEvent::setData()` instead
* Deprecate `PostSubmitEvent::setData()`, use `PreSubmitDataEvent::setData()` or `SubmitDataEvent::setData()` instead
FrameworkBundle
---------------
* [BC break] Add native return type to `Translator` and to `Application::reset()`
* Deprecate the integration of Doctrine annotations, either uninstall the `doctrine/annotations` package or disable
the integration by setting `framework.annotations` to `false`
* 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`, use `framework.validation.enable_attributes` instead
* Deprecate `framework.serializer.enable_annotations`, use `framework.serializer.enable_attributes` instead
* Deprecate the `routing.loader.annotation` service, use the `routing.loader.attribute` service instead
* Deprecate the `routing.loader.annotation.directory` service, use the `routing.loader.attribute.directory` service instead
* Deprecate the `routing.loader.annotation.file` service, use the `routing.loader.attribute.file` service instead
* Deprecate `AnnotatedRouteControllerLoader`, use `AttributeRouteControllerLoader` instead
HttpFoundation
--------------
* [BC break] Make `HeaderBag::getDate()`, `Response::getDate()`, `getExpires()` and `getLastModified()` return a `DateTimeImmutable`
HttpKernel
----------
* [BC break] `BundleInterface` no longer extends `ContainerAwareInterface`
* [BC break] Add native return types to `TraceableEventDispatcher` and to `MergeExtensionConfigurationPass`
* Deprecate `Kernel::stripComments()`
* Deprecate `UriSigner`, use `UriSigner` from the HttpFoundation component instead
* Deprecate `FileLinkFormatter`, use `FileLinkFormatter` from the ErrorHandler component instead
Messenger
---------
* Deprecate `StopWorkerOnSignalsListener` in favor of using the `SignalableCommandInterface`
* Deprecate `HandlerFailedException::getNestedExceptions()`, `HandlerFailedException::getNestedExceptionsOfClass()` and `DelayedMessageHandlingException::getExceptions()` which are replaced by a new `getWrappedExceptions()` method
MonologBridge
-------------
* [BC break] Add native return type to `Logger::clear()` and to `DebugProcessor::clear()`
PsrHttpMessageBridge
--------------------
* [BC break] `PsrServerRequestResolver` no longer implements `ArgumentValueResolverInterface`
RateLimiter
-----------
* Deprecate `SlidingWindow::getRetryAfter`, use `SlidingWindow::calculateTimeForTokens` instead
Routing
-------
* [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`, use `AttributeClassLoader` instead
* Deprecate `AnnotationDirectoryLoader`, use `AttributeDirectoryLoader` instead
* Deprecate `AnnotationFileLoader`, use `AttributeFileLoader` instead
Security
--------
* [BC break] `UserValueResolver` no longer implements `ArgumentValueResolverInterface`
* [BC break] Make `PersistentToken` immutable
* Deprecate accepting only `DateTime` for `TokenProviderInterface::updateToken()`, use `DateTimeInterface` instead
* [BC break] Add required `string $secret` parameter to the constructor of `DefaultLoginRateLimiter`
SecurityBundle
--------------
* Deprecate the `require_previous_session` config option. Setting it has no effect anymore
Serializer
----------
* Deprecate Doctrine annotations support in favor of native attributes
* Deprecate `AnnotationLoader`, use `AttributeLoader` instead
Templating
----------
* The component is deprecated and will be removed in 7.0, use [Twig](https://twig.symfony.com) instead
Translator
----------
* [BC Break] Add argument `$buildDir` to `DataCollectorTranslator::warmUp()`
Validator
---------
* Deprecate Doctrine annotations support in favor of native attributes
* Deprecate `ValidatorBuilder::setDoctrineAnnotationReader()`
* Deprecate `ValidatorBuilder::addDefaultDoctrineAnnotationReader()`
* Deprecate `ValidatorBuilder::enableAnnotationMapping()`, use `ValidatorBuilder::enableAttributeMapping()` instead
* Deprecate `ValidatorBuilder::disableAnnotationMapping()`, use `ValidatorBuilder::disableAttributeMapping()` instead
* Deprecate `AnnotationLoader`, use `AttributeLoader` instead
VarExporter
-----------
* Deprecate per-property lazy-initializers
Workflow
--------
* Deprecate `GuardEvent::getContext()` method that will be removed in 7.0
|