2019-05-19 12:51:44 +01:00
UPGRADE FROM 4.3 to 4.4
=======================
2019-06-25 16:29:23 +01:00
Cache
-----
* Added argument `$prefix` to `AdapterInterface::clear()`
2019-08-08 17:27:37 +01:00
* Marked the `CacheDataCollector` class as `@final` .
2019-06-25 16:29:23 +01:00
2019-09-01 18:33:46 +01:00
Console
-------
* Deprecated finding hidden commands using an abbreviation, use the full name instead
2019-09-30 19:52:02 +01:00
* Deprecated returning `null` from `Command::execute()` , return `0` instead
2019-08-08 17:27:37 +01:00
* Deprecated the `Application::renderException()` and `Application::doRenderException()` methods,
use `renderThrowable()` and `doRenderThrowable()` instead.
2019-09-01 18:33:46 +01:00
2019-07-10 03:50:49 +01:00
Debug
-----
2019-08-08 08:36:09 +01:00
* Deprecated the component in favor of the `ErrorHandler` component
2019-07-10 03:50:49 +01:00
2019-05-22 11:29:55 +01:00
Config
------
* Deprecated overriding the `FilerLoader::import()` method without declaring the optional `$exclude` argument
2019-05-19 12:51:44 +01:00
DependencyInjection
-------------------
2019-09-07 22:20:36 +01:00
* Made singly-implemented interfaces detection be scoped by file
2019-05-19 12:51:44 +01:00
* Deprecated support for short factories and short configurators in Yaml
Before:
```yaml
services:
2019-09-07 22:20:36 +01:00
my_service:
factory: factory_service:method
2019-05-19 12:51:44 +01:00
```
After:
```yaml
services:
2019-09-07 22:20:36 +01:00
my_service:
factory: ['@factory_service', method]
2019-05-19 12:51:44 +01:00
```
2019-09-07 22:20:36 +01:00
2019-07-05 10:51:03 +01:00
* Passing an instance of `Symfony\Component\DependencyInjection\Parameter` as class name to `Symfony\Component\DependencyInjection\Definition` is deprecated.
Before:
```php
new Definition(new Parameter('my_class'));
```
After:
```php
new Definition('%my_class%');
```
2019-04-23 07:04:30 +01:00
2019-07-30 18:32:27 +01:00
DoctrineBridge
--------------
* Deprecated injecting `ClassMetadataFactory` in `DoctrineExtractor` , an instance of `EntityManagerInterface` should be
injected instead.
* Deprecated passing an `IdReader` to the `DoctrineChoiceLoader` when the query cannot be optimized with single id field.
* Deprecated not passing an `IdReader` to the `DoctrineChoiceLoader` when the query can be optimized with single id field.
* Deprecated `RegistryInterface` , use `Doctrine\Common\Persistence\ManagerRegistry` .
2019-08-24 10:51:30 +01:00
* Added a new `getMetadataDriverClass` method to replace class parameters in `AbstractDoctrineExtension` . This method
will be abstract in Symfony 5 and must be declared in extending classes.
2019-07-05 10:51:03 +01:00
2019-07-02 07:30:32 +01:00
Filesystem
----------
* Support for passing a `null` value to `Filesystem::isAbsolutePath()` is deprecated.
2019-06-07 11:53:37 +01:00
Form
----
2019-07-24 15:46:11 +01:00
* Using different values for the "model_timezone" and "view_timezone" options of the `TimeType` without configuring a
reference date is deprecated.
2019-06-07 11:53:37 +01:00
* Using `int` or `float` as data for the `NumberType` when the `input` option is set to `string` is deprecated.
2019-08-09 08:43:48 +01:00
* Overriding the methods `FormIntegrationTestCase::setUp()` , `TypeTestCase::setUp()` and `TypeTestCase::tearDown()` without the `void` return-type is deprecated.
2019-06-07 11:53:37 +01:00
2019-05-30 16:17:31 +01:00
FrameworkBundle
---------------
2019-10-23 08:54:59 +01:00
* Deprecated calling `WebTestCase::createClient()` while a kernel has been booted, ensure the kernel is shut down before calling the method
2019-06-21 11:17:48 +01:00
* Deprecated support for `templating` engine in `TemplateController` , use Twig instead
2019-06-04 06:54:11 +01:00
* The `$parser` argument of `ControllerResolver::__construct()` and `DelegatingLoader::__construct()`
has been deprecated.
* The `ControllerResolver` and `DelegatingLoader` classes have been marked as `final` .
* The `controller_name_converter` and `resolve_controller_name_subscriber` services have been deprecated.
2019-07-17 13:55:17 +01:00
* Deprecated `routing.loader.service` , use `routing.loader.container` instead.
2019-07-18 07:35:24 +01:00
* Not tagging service route loaders with `routing.route_loader` has been deprecated.
2019-08-09 08:43:48 +01:00
* Overriding the methods `KernelTestCase::tearDown()` and `WebTestCase::tearDown()` without the `void` return-type is deprecated.
2019-08-08 17:27:37 +01:00
* Marked the `RouterDataCollector` class as `@final` .
2019-04-23 07:04:30 +01:00
2019-06-21 11:17:48 +01:00
HttpClient
----------
* Added method `cancel()` to `ResponseInterface`
2019-06-28 14:18:47 +01:00
HttpFoundation
--------------
* `ApacheRequest` is deprecated, use `Request` class instead.
2019-06-20 20:59:08 +01:00
* Passing a third argument to `HeaderBag::get()` is deprecated since Symfony 4.4, use method `all()` instead
2019-11-25 10:31:45 +00:00
* [BC BREAK] `PdoSessionHandler` with MySQL changed the type of the lifetime column,
make sure to run `ALTER TABLE sessions MODIFY sess_lifetime INTEGER UNSIGNED NOT NULL` to
update your database.
2019-08-14 15:53:04 +01:00
* `PdoSessionHandler` now precalculates the expiry timestamp in the lifetime column,
make sure to run `CREATE INDEX EXPIRY ON sessions (sess_lifetime)` to update your database
to speed up garbage collection of expired sessions.
2019-06-28 14:18:47 +01:00
2019-06-21 11:17:48 +01:00
HttpKernel
----------
* The `DebugHandlersListener` class has been marked as `final`
2019-08-01 03:33:32 +01:00
* Added new Bundle directory convention consistent with standard skeletons:
```
└── MyBundle/
├── config/
├── public/
├── src/
│ └── MyBundle.php
├── templates/
└── translations/
```
To make this work properly, it is necessary to change the root path of the bundle:
```php
class MyBundle extends Bundle
{
public function getPath(): string
{
return \dirname(__DIR__);
}
}
```
2019-04-23 07:04:30 +01:00
As many bundles must be compatible with a range of Symfony versions, the current
2019-08-01 03:33:32 +01:00
directory convention is not deprecated yet, but it will be in the future.
2019-09-07 22:20:36 +01:00
2019-08-20 15:47:04 +01:00
* Deprecated the second and third argument of `KernelInterface::locateResource`
* Deprecated the second and third argument of `FileLocator::__construct`
* Deprecated loading resources from `%kernel.root_dir%/Resources` and `%kernel.root_dir%` as
fallback directories. Resources like service definitions are usually loaded relative to the
current directory or with a glob pattern. The fallback directories have never been advocated
so you likely do not use those in any app based on the SF Standard or Flex edition.
2019-04-23 07:04:30 +01:00
* Getting the container from a non-booted kernel is deprecated
2019-08-08 17:27:37 +01:00
* Marked the `AjaxDataCollector` , `ConfigDataCollector` , `EventDataCollector` ,
`ExceptionDataCollector` , `LoggerDataCollector` , `MemoryDataCollector` ,
`RequestDataCollector` and `TimeDataCollector` classes as `@final` .
* Marked the `RouterDataCollector::collect()` method as `@final` .
* The `DataCollectorInterface::collect()` and `Profiler::collect()` methods third parameter signature
will be `\Throwable $exception = null` instead of `\Exception $exception = null` in Symfony 5.0.
2019-11-09 16:42:52 +00:00
* Deprecated methods `ExceptionEvent::get/setException()` , use `get/setThrowable()` instead
* Deprecated class `ExceptionListener` , use `ErrorListener` instead
2019-06-21 11:17:48 +01:00
2019-07-13 17:25:19 +01:00
Lock
----
* Deprecated `Symfony\Component\Lock\StoreInterface` in favor of `Symfony\Component\Lock\BlockingStoreInterface` and
2019-07-11 04:40:49 +01:00
`Symfony\Component\Lock\PersistingStoreInterface` .
2019-07-12 08:14:40 +01:00
* `Factory` is deprecated, use `LockFactory` instead
2019-11-29 09:39:08 +00:00
* Deprecated services `lock.store.flock` , `lock.store.semaphore` , `lock.store.memcached.abstract` and `lock.store.redis.abstract` ,
use `StoreFactory::createStore` instead.
2019-07-13 17:25:19 +01:00
2019-11-14 14:24:33 +00:00
Mailer
------
* [BC BREAK] Changed the DSN to use for disabling delivery (using the `NullTransport` ) from `smtp://null` to `null://null` (host doesn't matter).
2019-11-21 09:24:21 +00:00
* [BC BREAK] Renamed class `SmtpEnvelope` to `Envelope` and `DelayedSmtpEnvelope` to `DelayedEnvelope` .
* [BC BREAK] Added a required `string $transport` argument to `MessageEvent::__construct` .
2019-11-14 14:24:33 +00:00
2019-06-01 13:56:25 +01:00
Messenger
---------
2019-10-29 14:55:01 +00:00
* [BC BREAK] Removed `SendersLocatorInterface::getSenderByAlias` added in 4.3.
* [BC BREAK] Removed `$retryStrategies` argument from `Worker::__construct` .
2019-11-01 18:40:04 +00:00
* [BC BREAK] Changed arguments of `ConsumeMessagesCommand::__construct` .
2019-10-29 14:55:01 +00:00
* [BC BREAK] Removed `$senderClassOrAlias` argument from `RedeliveryStamp::__construct` .
* [BC BREAK] Removed `UnknownSenderException` .
2019-11-01 18:40:04 +00:00
* [BC BREAK] Removed `WorkerInterface` .
* [BC BREAK] Removed `$onHandledCallback` of `Worker::run(array $options = [], callable $onHandledCallback = null)` .
* [BC BREAK] Removed `StopWhenMemoryUsageIsExceededWorker` in favor of `StopWorkerOnMemoryLimitListener` .
* [BC BREAK] Removed `StopWhenMessageCountIsExceededWorker` in favor of `StopWorkerOnMessageLimitListener` .
* [BC BREAK] Removed `StopWhenTimeLimitIsReachedWorker` in favor of `StopWorkerOnTimeLimitListener` .
* [BC BREAK] Removed `StopWhenRestartSignalIsReceived` in favor of `StopWorkerOnRestartSignalListener` .
2019-08-08 17:27:37 +01:00
* Marked the `MessengerDataCollector` class as `@final` .
2019-06-01 13:56:25 +01:00
2019-08-21 08:00:46 +01:00
Mime
----
* Removed `NamedAddress` , use `Address` instead (which supports a name now)
2019-05-29 18:05:37 +01:00
MonologBridge
--------------
2019-06-01 13:56:25 +01:00
* The `RouteProcessor` has been marked final.
2019-04-23 07:04:30 +01:00
2019-07-10 08:40:26 +01:00
Process
-------
* Deprecated the `Process::inheritEnvironmentVariables()` method: env variables are always inherited.
2019-05-29 18:05:37 +01:00
2019-06-28 18:05:52 +01:00
PropertyAccess
--------------
* Deprecated passing `null` as 2nd argument of `PropertyAccessor::createCache()` method (`$defaultLifetime`), pass `0` instead.
2019-07-17 13:55:17 +01:00
Routing
-------
* Deprecated `ServiceRouterLoader` in favor of `ContainerLoader` .
* Deprecated `ObjectRouteLoader` in favor of `ObjectLoader` .
2019-04-17 20:13:54 +01:00
Security
--------
2019-07-31 03:17:21 +01:00
* The `LdapUserProvider` class has been deprecated, use `Symfony\Component\Ldap\Security\LdapUserProvider` instead.
2019-04-17 20:13:54 +01:00
* Implementations of `PasswordEncoderInterface` and `UserPasswordEncoderInterface` should add a new `needsRehash()` method
2019-08-23 16:57:29 +01:00
* Deprecated returning a non-boolean value when implementing `Guard\AuthenticatorInterface::checkCredentials()` . Please explicitly return `false` to indicate invalid credentials.
2019-11-26 17:28:34 +00:00
* The `ListenerInterface` is deprecated, extend `AbstractListener` instead.
2019-09-15 15:28:29 +01:00
* Deprecated passing more than one attribute to `AccessDecisionManager::decide()` and `AuthorizationChecker::isGranted()` (and indirectly the `is_granted()` Twig and ExpressionLanguage function)
2019-04-23 07:04:30 +01:00
2019-09-15 15:28:29 +01:00
**Before**
```php
if ($this->authorizationChecker->isGranted(['ROLE_USER', 'ROLE_ADMIN'])) {
// ...
}
```
2019-04-23 07:04:30 +01:00
2019-09-15 15:28:29 +01:00
**After**
```php
2019-11-25 14:00:05 +00:00
if ($this->authorizationChecker->isGranted(new Expression("is_granted('ROLE_USER') or is_granted('ROLE_ADMIN')"))) {}
2019-09-15 15:28:29 +01:00
// or:
if ($this->authorizationChecker->isGranted('ROLE_USER')
|| $this->authorizationChecker->isGranted('ROLE_ADMIN')
) {}
```
2019-04-17 20:13:54 +01:00
2019-08-08 17:27:37 +01:00
SecurityBundle
--------------
* Marked the `SecurityDataCollector` class as `@final` .
2019-10-02 10:02:25 +01:00
Serializer
----------
* Deprecated the `XmlEncoder::TYPE_CASE_ATTRIBUTES` constant. Use `XmlEncoder::TYPE_CAST_ATTRIBUTES` instead.
2019-07-06 15:12:52 +01:00
Stopwatch
---------
* Deprecated passing `null` as 1st (`$id`) argument of `Section::get()` method, pass a valid child section identifier instead.
2019-08-21 09:02:59 +01:00
Translation
-----------
* Deprecated support for using `null` as the locale in `Translator` .
2019-09-06 23:34:50 +01:00
* Deprecated accepting STDIN implicitly when using the `lint:xliff` command, use `lint:xliff -` (append a dash) instead to make it explicit.
2019-08-08 17:27:37 +01:00
* Marked the `TranslationDataCollector` class as `@final` .
2019-08-21 09:02:59 +01:00
2019-05-29 13:39:34 +01:00
TwigBridge
----------
2019-06-28 14:18:47 +01:00
* Deprecated to pass `$rootDir` and `$fileLinkFormatter` as 5th and 6th argument respectively to the
2019-06-01 13:56:25 +01:00
`DebugCommand::__construct()` method, swap the variables position.
2019-09-06 23:34:50 +01:00
* Deprecated accepting STDIN implicitly when using the `lint:twig` command, use `lint:twig -` (append a dash) instead to make it explicit.
2019-08-08 17:27:37 +01:00
* Marked the `TwigDataCollector` class as `@final` .
2019-04-23 07:04:30 +01:00
2019-07-22 18:18:46 +01:00
TwigBundle
----------
2019-11-22 16:50:01 +00:00
* Deprecated `twig.exception_controller` configuration option.
If you were not using this option previously, set it to `null` :
After:
```yaml
twig:
exception_controller: null
```
If you were using this option previously, set it to `null` and use `framework.error_controller` instead:
2019-04-23 07:04:30 +01:00
2019-08-21 07:21:47 +01:00
Before:
```yaml
twig:
exception_controller: 'App\Controller\MyExceptionController'
```
2019-04-23 07:04:30 +01:00
2019-08-21 07:21:47 +01:00
After:
```yaml
twig:
exception_controller: null
framework:
error_controller: 'App\Controller\MyExceptionController'
```
2019-04-23 07:04:30 +01:00
The new default exception controller will also change the error response content according to
2019-08-21 07:21:47 +01:00
https://tools.ietf.org/html/rfc7807 for `json` , `xml` , `atom` and `txt` formats:
2019-04-23 07:04:30 +01:00
2019-07-22 18:18:46 +01:00
Before:
```json
2019-04-23 07:04:30 +01:00
{
"error": {
"code": 404,
"message": "Sorry, the page you are looking for could not be found"
}
2019-07-22 18:18:46 +01:00
}
```
2019-04-23 07:04:30 +01:00
2019-07-22 18:18:46 +01:00
After:
```json
2019-04-23 07:04:30 +01:00
{
2019-07-22 18:18:46 +01:00
"title": "Not Found",
2019-04-23 07:04:30 +01:00
"status": 404,
2019-07-22 18:18:46 +01:00
"detail": "Sorry, the page you are looking for could not be found"
}
```
2019-04-23 07:04:30 +01:00
2019-08-21 07:21:47 +01:00
* Deprecated the `ExceptionController` and `PreviewErrorController` controllers, use `ErrorController` from the HttpKernel component instead
2019-11-10 18:52:50 +00:00
* Deprecated all built-in error templates, use the error renderer mechanism of the `ErrorHandler` component
2019-04-23 07:04:30 +01:00
* Deprecated loading custom error templates in non-html formats. Custom HTML error pages based on Twig keep working as before:
2019-07-22 18:18:46 +01:00
2019-11-10 13:46:37 +00:00
Before (`templates/bundles/TwigBundle/Exception/error.json.twig`):
2019-07-22 18:18:46 +01:00
```twig
2019-04-23 07:04:30 +01:00
{
2019-11-10 13:46:37 +00:00
"type": "https://example.com/error",
"title": "{{ status_text }}",
"status": {{ status_code }}
2019-07-22 18:18:46 +01:00
}
```
2019-04-23 07:04:30 +01:00
2019-11-10 13:46:37 +00:00
After (`App\Serializer\ProblemJsonNormalizer`):
2019-07-22 18:18:46 +01:00
```php
2019-11-10 13:46:37 +00:00
class ProblemJsonNormalizer implements NormalizerInterface
2019-07-22 18:18:46 +01:00
{
2019-11-10 13:46:37 +00:00
public function normalize($exception, $format = null, array $context = [])
2019-09-07 22:20:36 +01:00
{
2019-11-10 13:46:37 +00:00
return [
'type' => 'https://example.com/error',
'title' => $exception->getStatusText(),
'status' => $exception->getStatusCode(),
];
2019-09-07 22:20:36 +01:00
}
2019-04-23 07:04:30 +01:00
2019-11-10 13:46:37 +00:00
public function supportsNormalization($data, $format = null)
2019-09-07 22:20:36 +01:00
{
2019-11-10 13:46:37 +00:00
return 'json' === $format & & $data instanceof FlattenException;
2019-09-07 22:20:36 +01:00
}
2019-07-22 18:18:46 +01:00
}
```
2019-06-14 09:27:35 +01:00
Validator
---------
2019-11-29 09:39:08 +00:00
* [BC BREAK] Using null as `$classValidatorRegexp` value in `DoctrineLoader::__construct` or `PropertyInfoLoader::__construct` will not enable auto-mapping for all classes anymore, use `'{.*}'` instead.
2019-06-28 14:18:47 +01:00
* Deprecated passing an `ExpressionLanguage` instance as the second argument of `ExpressionValidator::__construct()` .
2019-06-28 17:16:38 +01:00
* Deprecated using anything else than a `string` as the code of a `ConstraintViolation` , a `string` type-hint will
be added to the constructor of the `ConstraintViolation` class and to the `ConstraintViolationBuilder::setCode()`
method in 5.0.
2019-04-23 07:04:30 +01:00
* Deprecated passing an `ExpressionLanguage` instance as the second argument of `ExpressionValidator::__construct()` .
2019-06-14 09:27:35 +01:00
Pass it as the first argument instead.
2019-05-22 10:46:46 +01:00
* The `Length` constraint expects the `allowEmptyString` option to be defined
when the `min` option is used.
Set it to `true` to keep the current behavior and `false` to reject empty strings.
In 5.0, it'll become optional and will default to `false` .
2019-08-09 08:43:48 +01:00
* Overriding the methods `ConstraintValidatorTestCase::setUp()` and `ConstraintValidatorTestCase::tearDown()` without the `void` return-type is deprecated.
2019-09-04 18:50:18 +01:00
* deprecated `Symfony\Component\Validator\Mapping\Cache\CacheInterface` and all implementations in favor of PSR-6.
* deprecated `ValidatorBuilder::setMetadataCache` , use `ValidatorBuilder::setMappingCache` instead.
2019-10-07 08:03:17 +01:00
* The `Range` constraint has a new message option `notInRangeMessage` that is used when both `min` and `max` values are set.
In case you are using custom translations make sure to add one for this new message.
2019-08-08 17:27:37 +01:00
* Marked the `ValidatorDataCollector` class as `@final` .
2019-07-09 16:22:11 +01:00
WebProfilerBundle
-----------------
2019-07-24 00:59:27 +01:00
* Deprecated the `ExceptionController` class in favor of `ExceptionErrorController`
2019-07-09 16:22:11 +01:00
* Deprecated the `TemplateManager::templateExists()` method
2019-07-13 17:25:19 +01:00
WebServerBundle
---------------
* The bundle is deprecated and will be removed in 5.0.
2019-04-23 07:04:30 +01:00
2019-09-06 23:34:50 +01:00
Yaml
----
* Deprecated accepting STDIN implicitly when using the `lint:yaml` command, use `lint:yaml -` (append a dash) instead to make it explicit.