2017-05-21 11:28:38 +01:00
UPGRADE FROM 3.3 to 3.4
=======================
2017-10-26 07:11:55 +01:00
Config
------
2017-10-28 17:56:07 +01:00
* The protected `TreeBuilder::$builder` property is deprecated and will be removed in 4.0.
2017-05-21 11:28:38 +01:00
2017-05-25 07:46:02 +01:00
DependencyInjection
-------------------
2017-09-17 10:49:41 +01:00
* Definitions and aliases will be made private by default in 4.0. You should either use service injection
or explicitly define your services as public if you really need to inject the container.
2017-08-03 10:15:05 +01:00
* Relying on service auto-registration while autowiring is deprecated and won't be supported
2017-07-29 14:29:10 +01:00
in Symfony 4.0. Explicitly inject your dependencies or create services
whose ids are their fully-qualified class name.
Before:
```php
namespace App\Controller;
use App\Mailer;
class DefaultController
{
public function __construct(Mailer $mailer) {
// ...
}
// ...
}
```
```yml
services:
App\Controller\DefaultController:
autowire: true
```
After:
```php
// same PHP code
```
```yml
services:
App\Controller\DefaultController:
autowire: true
# or
# App\Controller\DefaultController:
# arguments: { $mailer: "@App\Mailer" }
App\Mailer:
autowire: true
2017-08-03 10:15:05 +01:00
```
2017-07-29 14:29:10 +01:00
2017-06-09 09:00:19 +01:00
* Top-level anonymous services in XML are deprecated and will throw an exception in Symfony 4.0.
2017-05-25 07:46:02 +01:00
2017-08-31 13:57:27 +01:00
* Case insensitivity of parameter names is deprecated and will be removed in 4.0.
2017-09-07 09:34:20 +01:00
* The `ResolveDefinitionTemplatesPass` class is deprecated and will be removed in 4.0.
Use the `ResolveChildDefinitionsPass` class instead.
2017-05-21 16:02:52 +01:00
Debug
-----
* Support for stacked errors in the `ErrorHandler` is deprecated and will be removed in Symfony 4.0.
2017-10-05 14:13:44 +01:00
DoctrineBridge
--------------
* Deprecated `Symfony\Bridge\Doctrine\HttpFoundation\DbalSessionHandler` and
`Symfony\Bridge\Doctrine\HttpFoundation\DbalSessionHandlerSchema` . Use
`Symfony\Component\HttpFoundation\Session\Storage\Handler\PdoSessionHandler` instead.
2017-10-05 10:48:08 +01:00
EventDispatcher
---------------
* Implementing `TraceableEventDispatcherInterface` without the `reset()` method
is deprecated and will be unsupported in 4.0.
2017-07-31 08:31:57 +01:00
Filesystem
----------
* The `Symfony\Component\Filesystem\LockHandler` class has been deprecated,
use the `Symfony\Component\Lock\Store\FlockStore` class
or the `Symfony\Component\Lock\Store\FlockStore\SemaphoreStore` class directly instead.
2017-09-14 13:29:42 +01:00
* Support for passing relative paths to `Filesystem::makePathRelative()` is deprecated and will be removed in 4.0.
2017-07-31 08:31:57 +01:00
2017-05-21 13:08:16 +01:00
Finder
------
* The `Symfony\Component\Finder\Iterator\FilterIterator` class has been
2017-05-25 10:38:18 +01:00
deprecated and will be removed in 4.0 as it used to fix a bug which existed
2017-05-25 07:46:02 +01:00
before version 5.5.23/5.6.7.
2017-05-21 13:08:16 +01:00
2017-07-24 16:43:04 +01:00
Form
----
* Deprecated `ChoiceLoaderInterface` implementation in `TimezoneType` . Use the "choice_loader" option instead.
Before:
```php
class MyTimezoneType extends TimezoneType
{
public function loadChoices()
{
// override the method
}
}
```
After:
```php
class MyTimezoneType extends AbstractType
{
2017-11-13 03:45:58 +00:00
public function getParent()
2017-07-24 16:43:04 +01:00
{
return TimezoneType::class;
}
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefault('choice_loader', ...); // override the option instead
}
}
```
2017-05-09 08:19:29 +01:00
FrameworkBundle
---------------
2017-10-10 10:13:08 +01:00
* The `session.use_strict_mode` option has been deprecated and is enabled by default.
2017-09-26 10:37:36 +01:00
* The `cache:clear` command doesn't clear "app" PSR-6 cache pools anymore,
but still clears "system" ones.
Use the `cache:pool:clear` command to clear "app" pools instead.
2017-06-11 01:55:29 +01:00
* The `doctrine/cache` dependency has been removed; require it via `composer
require doctrine/cache` if you are using Doctrine cache in your project.
2017-06-11 01:54:55 +01:00
* The `validator.mapping.cache.doctrine.apc` service has been deprecated.
2017-06-12 15:27:27 +01:00
* The `symfony/stopwatch` dependency has been removed, require it via `composer
require symfony/stopwatch` in your `dev` environment.
2017-06-12 19:05:06 +01:00
2017-05-09 08:19:29 +01:00
* Using the `KERNEL_DIR` environment variable or the automatic guessing based
2017-07-29 14:29:10 +01:00
on the `phpunit.xml` / `phpunit.xml.dist` file location is deprecated since 3.4.
2017-05-09 08:19:29 +01:00
Set the `KERNEL_CLASS` environment variable to the fully-qualified class name
2017-07-29 14:29:10 +01:00
of your Kernel instead. Not setting the `KERNEL_CLASS` environment variable
will throw an exception on 4.0 unless you override the `KernelTestCase::createKernel()`
2017-05-09 08:19:29 +01:00
or `KernelTestCase::getKernelClass()` method.
2017-07-29 14:29:10 +01:00
* The `KernelTestCase::getPhpUnitXmlDir()` and `KernelTestCase::getPhpUnitCliConfigArgument()`
2017-05-09 08:19:29 +01:00
methods are deprecated since 3.4 and will be removed in 4.0.
2017-06-13 10:38:29 +01:00
* The `--no-prefix` option of the `translation:update` command is deprecated and
will be removed in 4.0. Use the `--prefix` option with an empty string as value
instead (e.g. `--prefix=""` )
2017-05-03 13:00:53 +01:00
* The `Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\AddCacheClearerPass`
2017-09-28 15:57:16 +01:00
class has been deprecated and will be removed in 4.0. Use tagged iterator arguments instead.
2017-05-03 13:00:53 +01:00
* The `Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\AddCacheWarmerPass`
2017-09-28 15:57:16 +01:00
class has been deprecated and will be removed in 4.0. Use tagged iterator arguments instead.
2017-07-06 07:49:25 +01:00
2017-05-05 11:35:04 +01:00
* The `Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\TranslationDumperPass`
class has been deprecated and will be removed in 4.0. Use the
`Symfony\Component\Translation\DependencyInjection\TranslationDumperPass` class instead.
* The `Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\TranslationExtractorPass`
class has been deprecated and will be removed in 4.0. Use the
`Symfony\Component\Translation\DependencyInjection\TranslationExtractorPass` class instead.
* The `Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\TranslatorPass`
class has been deprecated and will be removed in 4.0. Use the
`Symfony\Component\Translation\DependencyInjection\TranslatorPass` class instead.
2017-07-25 19:07:39 +01:00
* The `Symfony\Bundle\FrameworkBundle\Translation\TranslationLoader`
class has been deprecated and will be removed in 4.0. Use the
`Symfony\Component\Translation\Reader\TranslationReader` class instead.
2017-09-17 10:49:41 +01:00
2017-08-12 11:12:58 +01:00
* The `translation.loader` service has been deprecated and will be removed in 4.0.
Use the `translation.reader` service instead..
* `AssetsInstallCommand::__construct()` now takes an instance of
`Symfony\Component\Filesystem\Filesystem` as first argument.
Not passing it is deprecated and will throw a `TypeError` in 4.0.
* `CacheClearCommand::__construct()` now takes an instance of
`Symfony\Component\HttpKernel\CacheClearer\CacheClearerInterface` as
first argument. Not passing it is deprecated and will throw
a `TypeError` in 4.0.
* `CachePoolClearCommand::__construct()` now takes an instance of
`Symfony\Component\HttpKernel\CacheClearer\Psr6CacheClearer` as
first argument. Not passing it is deprecated and will throw
a `TypeError` in 4.0.
* `EventDispatcherDebugCommand::__construct()` now takes an instance of
`Symfony\Component\EventDispatcher\EventDispatcherInterface` as
first argument. Not passing it is deprecated and will throw
a `TypeError` in 4.0.
* `RouterDebugCommand::__construct()` now takes an instance of
`Symfony\Component\Routing\RouterInteface` as
first argument. Not passing it is deprecated and will throw
a `TypeError` in 4.0.
* `RouterMatchCommand::__construct()` now takes an instance of
`Symfony\Component\Routing\RouterInteface` as
first argument. Not passing it is deprecated and will throw
a `TypeError` in 4.0.
* `TranslationDebugCommand::__construct()` now takes an instance of
`Symfony\Component\Translation\TranslatorInterface` as
first argument. Not passing it is deprecated and will throw
a `TypeError` in 4.0.
* `TranslationUpdateCommand::__construct()` now takes an instance of
`Symfony\Component\Translation\TranslatorInterface` as
first argument. Not passing it is deprecated and will throw
a `TypeError` in 4.0.
* `AssetsInstallCommand` , `CacheClearCommand` , `CachePoolClearCommand` ,
`EventDispatcherDebugCommand` , `RouterDebugCommand` , `RouterMatchCommand` ,
`TranslationDebugCommand` , `TranslationUpdateCommand` , `XliffLintCommand`
and `YamlLintCommand` classes have been marked as final
2017-07-25 19:07:39 +01:00
2017-09-14 08:57:19 +01:00
* The `Symfony\Bundle\FrameworkBundle\Translation\PhpExtractor`
class has been deprecated and will be removed in 4.0. Use the
`Symfony\Component\Translation\Extractor\PhpExtractor` class instead.
* The `Symfony\Bundle\FrameworkBundle\Translation\PhpStringTokenParser`
class has been deprecated and will be removed in 4.0. Use the
`Symfony\Component\Translation\Extractor\PhpStringTokenParser` class instead.
2017-09-17 13:54:32 +01:00
HttpFoundation
--------------
* The `Symfony\Component\HttpFoundation\Session\Storage\Handler\NativeSessionHandler`
class has been deprecated and will be removed in 4.0. Use the `\SessionHandler` class instead.
2017-10-10 10:13:08 +01:00
* The `Symfony\Component\HttpFoundation\Session\Storage\Handler\WriteCheckSessionHandler` class has been
deprecated and will be removed in 4.0. Implement `SessionUpdateTimestampHandlerInterface` or
extend `AbstractSessionHandler` instead.
2017-09-17 13:54:32 +01:00
* The `Symfony\Component\HttpFoundation\Session\Storage\Proxy\NativeProxy` class has been
deprecated and will be removed in 4.0. Use your `\SessionHandlerInterface` implementation directly.
2017-10-05 13:27:30 +01:00
* Using `Symfony\Component\HttpFoundation\Session\Storage\Handler\MongoDbSessionHandler` with the legacy mongo extension
has been deprecated and will be removed in 4.0. Use it with the mongodb/mongodb package and ext-mongodb instead.
2017-10-05 16:58:33 +01:00
* The `Symfony\Component\HttpFoundation\Session\Storage\Handler\MemcacheSessionHandler` class has been deprecated and
will be removed in 4.0. Use `Symfony\Component\HttpFoundation\Session\Storage\Handler\MemcachedSessionHandler` instead.
2017-08-06 13:15:02 +01:00
HttpKernel
----------
2017-09-11 18:56:43 +01:00
* Bundle inheritance has been deprecated.
2017-08-06 13:15:02 +01:00
* Relying on convention-based commands discovery has been deprecated and
won't be supported in 4.0. Use PSR-4 based service discovery instead.
Before:
```yml
# app/config/services.yml
services:
# ...
# implicit registration of all commands in the `Command` folder
```
After:
```yml
# app/config/services.yml
services:
# ...
# explicit commands registration
2017-12-07 13:36:34 +00:00
AppBundle\Command\:
2017-08-06 13:15:02 +01:00
resource: '../../src/AppBundle/Command/*'
tags: ['console.command']
```
2017-08-04 13:41:57 +01:00
* The `getCacheDir()` method of your kernel should not be called while building the container.
Use the `%kernel.cache_dir%` parameter instead. Not doing so may break the `cache:clear` command.
2017-09-01 19:06:13 +01:00
* The `Symfony\Component\HttpKernel\Config\EnvParametersResource` class has been deprecated and will be removed in 4.0.
2017-10-05 10:48:08 +01:00
* Implementing `DataCollectorInterface` without a `reset()` method has been deprecated and will be unsupported in 4.0.
* Implementing `DebugLoggerInterface` without a `clear()` method has been deprecated and will be unsupported in 4.0.
2017-09-28 15:57:16 +01:00
* The `ChainCacheClearer::add()` method has been deprecated and will be removed in 4.0,
inject the list of clearers as a constructor argument instead.
* The `CacheWarmerAggregate::add()` and `setWarmers()` methods have been deprecated and will be removed in 4.0,
inject the list of clearers as a constructor argument instead.
* The `CacheWarmerAggregate` and `ChainCacheClearer` classes have been made final.
2017-06-08 19:25:37 +01:00
Process
-------
* The `Symfony\Component\Process\ProcessBuilder` class has been deprecated,
use the `Symfony\Component\Process\Process` class directly instead.
2017-07-28 22:09:12 +01:00
* Calling `Process::start()` without setting a valid working directory (via `setWorkingDirectory()` or constructor) beforehand is deprecated and will throw an exception in 4.0.
2017-09-11 18:47:15 +01:00
Profiler
--------
* The `profiler.matcher` option has been deprecated.
2017-09-26 18:05:58 +01:00
Security
--------
2017-09-14 08:57:19 +01:00
* Deprecated the HTTP digest authentication: `NonceExpiredException` ,
`DigestAuthenticationListener` and `DigestAuthenticationEntryPoint` will be
2017-09-26 18:05:58 +01:00
removed in 4.0. Use another authentication system like `http_basic` instead.
2017-10-05 08:59:11 +01:00
* The `GuardAuthenticatorInterface` has been deprecated and will be removed in 4.0.
Use `AuthenticatorInterface` instead.
2017-09-26 18:05:58 +01:00
2017-06-09 09:00:19 +01:00
SecurityBundle
--------------
2017-05-04 08:35:02 +01:00
* Using voters that do not implement the `VoterInterface` is now deprecated in
the `AccessDecisionManager` and this functionality will be removed in 4.0.
feature #22629 [Security] Trigger a deprecation when a voter is missing the VoterInterface (iltar)
This PR was squashed before being merged into the 3.4 branch (closes #22629).
Discussion
----------
[Security] Trigger a deprecation when a voter is missing the VoterInterface
| Q | A
| ------------- | ---
| Branch? | 3.4
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | yes
| Tests pass? | yes
| Fixed tickets | ~
| License | MIT
| Doc PR | ~
Right now it's possible to add voters to the access decision manager that do not have a `VoterInterface`.
- No Interface, no `vote()` method, and it will give a PHP error.
- No Interface, but `vote()` method, it will still work.
- If I don't implement the interface _and_ have no `vote()` method, I will get weird exception that's not meaningful: `Attempted to call an undefined method named "vote" of class "App\Voter\MyVoter".`
This PR will deprecate the ability to use voters without the interface, it will also throw a proper exception when missing the interface _and_ the `vote()` method. Why when using and not when setting? Due to the fact that the voters can be set lazily via the `IteratorArgument`. The SecurityBundle will trigger a deprecation if the interface is not implemented and an exception if there's not even a `vote()` method present (to prevent exceptions at run-time).
This should have full backwards compatibility with 3.3, but give more meaningful errors. The only behavioral difference, might be that the container will throw an exception instead of maybe succeeding in voting when 1 voter would be broken at the end of the list (based on strategy). This case however, will be detected during development and deployment, rather than run-time.
Commits
-------
9c253e1ff6 [Security] Trigger a deprecation when a voter is missing the VoterInterface
2017-06-15 15:23:21 +01:00
2017-06-09 09:00:19 +01:00
* `FirewallContext::getListeners()` now returns `\Traversable|array`
2017-08-12 11:12:58 +01:00
* `InitAclCommand::__construct()` now takes an instance of
`Doctrine\DBAL\Connection` as first argument. Not passing it is
deprecated and will throw a `TypeError` in 4.0.
2017-09-25 10:36:55 +01:00
* The `acl:set` command has been deprecated along with the `SetAclCommand` class,
both will be removed in 4.0. Install symfony/acl-bundle instead
* The `init:acl` command has been deprecated along with the `InitAclCommand` class,
both will be removed in 4.0. Install symfony/acl-bundle and use `acl:init` instead
2017-08-12 11:12:58 +01:00
2017-08-14 09:19:33 +01:00
* Added `logout_on_user_change` to the firewall options. This config item will
trigger a logout when the user has changed. Should be set to true to avoid
deprecations in the configuration.
2017-09-14 08:57:19 +01:00
2017-09-26 18:05:58 +01:00
* Deprecated the HTTP digest authentication: `HttpDigestFactory` will be removed in 4.0.
Use another authentication system like `http_basic` instead.
2017-10-05 10:48:08 +01:00
2017-09-28 12:56:55 +01:00
* Deprecated setting the `switch_user.stateless` option to false when the firewall is `stateless` .
Setting it to false will have no effect in 4.0.
2017-08-14 09:19:33 +01:00
2017-10-05 10:48:08 +01:00
* Not configuring explicitly the provider on a firewall is ambiguous when there is more than one registered provider.
2017-09-29 19:40:54 +01:00
Using the first configured provider is deprecated since 3.4 and will throw an exception on 4.0.
Explicitly configure the provider to use on your firewalls.
2017-08-14 09:19:33 +01:00
2017-07-25 18:57:30 +01:00
Translation
-----------
2017-09-17 10:49:41 +01:00
* `Symfony\Component\Translation\Writer\TranslationWriter::writeTranslations` has been deprecated
and will be removed in 4.0, use `Symfony\Component\Translation\Writer\TranslationWriter::write`
instead.
2017-07-25 18:57:30 +01:00
2016-09-18 09:17:44 +01:00
* Passing a `Symfony\Component\Translation\MessageSelector` to `Translator` has been
deprecated. You should pass a message formatter instead
Before:
```php
use Symfony\Component\Translation\Translator;
use Symfony\Component\Translation\MessageSelector;
$translator = new Translator('fr_FR', new MessageSelector());
```
After:
```php
use Symfony\Component\Translation\Translator;
use Symfony\Component\Translation\Formatter\MessageFormatter;
$translator = new Translator('fr_FR', new MessageFormatter());
```
2017-07-19 07:45:45 +01:00
TwigBridge
----------
* deprecated the `Symfony\Bridge\Twig\Form\TwigRenderer` class, use the `FormRenderer`
class from the Form component instead
2017-07-29 14:29:10 +01:00
* deprecated `Symfony\Bridge\Twig\Command\DebugCommand::set/getTwigEnvironment` and the ability
2017-07-15 11:11:15 +01:00
to pass a command name as first argument
* deprecated `Symfony\Bridge\Twig\Command\LintCommand::set/getTwigEnvironment` and the ability
to pass a command name as first argument
TwigBundle
----------
* deprecated the `Symfony\Bundle\TwigBundle\Command\DebugCommand` class, use the `DebugCommand`
class from the Twig bridge instead
2017-07-29 14:29:10 +01:00
* deprecated relying on the `ContainerAwareInterface` implementation for
2017-07-15 11:11:15 +01:00
`Symfony\Bundle\TwigBundle\Command\LintCommand`
2017-05-21 11:28:38 +01:00
Validator
---------
2017-05-25 07:46:02 +01:00
* Not setting the `strict` option of the `Choice` constraint to `true` is
deprecated and will throw an exception in Symfony 4.0.
2017-05-25 10:38:18 +01:00
Yaml
----
2017-08-29 21:51:11 +01:00
* the `Dumper` , `Parser` , and `Yaml` classes are marked as final
2017-05-25 11:16:49 +01:00
* using the `!php/object:` tag is deprecated and won't be supported in 4.0. Use
the `!php/object` tag (without the colon) instead.
* using the `!php/const:` tag is deprecated and won't be supported in 4.0. Use
the `!php/const` tag (without the colon) instead.
Before:
```yml
!php/const:PHP_INT_MAX
```
After:
```yml
!php/const PHP_INT_MAX
```
2017-06-24 15:09:41 +01:00
* Support for the `!str` tag is deprecated, use the `!!str` tag instead.
2017-05-25 10:38:18 +01:00
* Using the non-specific tag `!` is deprecated and will have a different
behavior in 4.0. Use a plain integer or `!!float` instead.
2017-05-29 21:10:45 +01:00
* Using the `Yaml::PARSE_KEYS_AS_STRINGS` flag is deprecated as it will be
removed in 4.0.
Before:
```php
$yaml = < < < YAML
null: null key
true: boolean true
2.0: float key
YAML;
Yaml::parse($yaml, Yaml::PARSE_KEYS_AS_STRINGS);
```
After:
```php
$yaml = < < < YAML
"null": null key
"true": boolean true
"2.0": float key
YAML;
Yaml::parse($yaml);
```