This PR was squashed before being merged into the 3.4 branch (closes #24438). Discussion ---------- [Session][VarDumper] Deprecate accepting legacy mongo extension | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | no | New feature? | no <!-- don't forget to update src/**/CHANGELOG.md files --> | BC breaks? | no | Deprecations? | yes | Tests pass? | yes | Fixed tickets | | License | MIT | Doc PR | The old ext-mongo is deprecated and does not work with PHP 7. See http://php.net/manual/en/mongo.setup.php People should use mongodb/mongodb and ext-mongodb instead. This deprecates functionality using the old ext-mongo classes. Commits -------d535ff60c2
[VarDumper] deprecate MongoCaster6651af07c2
[HttpFoundation] deprecate using with the legacy mongo extension; use it with the mongodb/mongodb package and ext-mongodb instead
16 KiB
UPGRADE FROM 3.3 to 3.4
DependencyInjection
-
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.
-
Relying on service auto-registration while autowiring is deprecated and won't be supported in Symfony 4.0. Explicitly inject your dependencies or create services whose ids are their fully-qualified class name.
Before:
namespace App\Controller; use App\Mailer; class DefaultController { public function __construct(Mailer $mailer) { // ... } // ... }
services: App\Controller\DefaultController: autowire: true
After:
// same PHP code
services: App\Controller\DefaultController: autowire: true # or # App\Controller\DefaultController: # arguments: { $mailer: "@App\Mailer" } App\Mailer: autowire: true
-
Top-level anonymous services in XML are deprecated and will throw an exception in Symfony 4.0.
-
Case insensitivity of parameter names is deprecated and will be removed in 4.0.
-
The
ResolveDefinitionTemplatesPass
class is deprecated and will be removed in 4.0. Use theResolveChildDefinitionsPass
class instead.
Debug
- Support for stacked errors in the
ErrorHandler
is deprecated and will be removed in Symfony 4.0.
EventDispatcher
- Implementing
TraceableEventDispatcherInterface
without thereset()
method is deprecated and will be unsupported in 4.0.
Filesystem
- The
Symfony\Component\Filesystem\LockHandler
class has been deprecated, use theSymfony\Component\Lock\Store\FlockStore
class or theSymfony\Component\Lock\Store\FlockStore\SemaphoreStore
class directly instead. - Support for passing relative paths to
Filesystem::makePathRelative()
is deprecated and will be removed in 4.0.
Finder
- The
Symfony\Component\Finder\Iterator\FilterIterator
class has been deprecated and will be removed in 4.0 as it used to fix a bug which existed before version 5.5.23/5.6.7.
Form
-
Deprecated
ChoiceLoaderInterface
implementation inTimezoneType
. Use the "choice_loader" option instead.Before:
class MyTimezoneType extends TimezoneType { public function loadChoices() { // override the method } }
After:
class MyTimezoneType extends AbstractType { public function. getParent() { return TimezoneType::class; } public function configureOptions(OptionsResolver $resolver) { $resolver->setDefault('choice_loader', ...); // override the option instead } }
FrameworkBundle
-
The
cache:clear
command doesn't clear "app" PSR-6 cache pools anymore, but still clears "system" ones. Use thecache:pool:clear
command to clear "app" pools instead. -
The
doctrine/cache
dependency has been removed; require it viacomposer require doctrine/cache
if you are using Doctrine cache in your project. -
The
validator.mapping.cache.doctrine.apc
service has been deprecated. -
The
symfony/stopwatch
dependency has been removed, require it viacomposer require symfony/stopwatch
in yourdev
environment. -
Using the
KERNEL_DIR
environment variable or the automatic guessing based on thephpunit.xml
/phpunit.xml.dist
file location is deprecated since 3.4. Set theKERNEL_CLASS
environment variable to the fully-qualified class name of your Kernel instead. Not setting theKERNEL_CLASS
environment variable will throw an exception on 4.0 unless you override theKernelTestCase::createKernel()
orKernelTestCase::getKernelClass()
method. -
The
KernelTestCase::getPhpUnitXmlDir()
andKernelTestCase::getPhpUnitCliConfigArgument()
methods are deprecated since 3.4 and will be removed in 4.0. -
The
--no-prefix
option of thetranslation: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=""
) -
The
Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\AddCacheClearerPass
class has been deprecated and will be removed in 4.0. Use tagged iterator arguments instead. -
The
Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\AddCacheWarmerPass
class has been deprecated and will be removed in 4.0. Use tagged iterator arguments instead. -
The
Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\TranslationDumperPass
class has been deprecated and will be removed in 4.0. Use theSymfony\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 theSymfony\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 theSymfony\Component\Translation\DependencyInjection\TranslatorPass
class instead. -
The
Symfony\Bundle\FrameworkBundle\Translation\TranslationLoader
class has been deprecated and will be removed in 4.0. Use theSymfony\Component\Translation\Reader\TranslationReader
class instead. -
The
translation.loader
service has been deprecated and will be removed in 4.0. Use thetranslation.reader
service instead.. -
AssetsInstallCommand::__construct()
now takes an instance ofSymfony\Component\Filesystem\Filesystem
as first argument. Not passing it is deprecated and will throw aTypeError
in 4.0. -
CacheClearCommand::__construct()
now takes an instance ofSymfony\Component\HttpKernel\CacheClearer\CacheClearerInterface
as first argument. Not passing it is deprecated and will throw aTypeError
in 4.0. -
CachePoolClearCommand::__construct()
now takes an instance ofSymfony\Component\HttpKernel\CacheClearer\Psr6CacheClearer
as first argument. Not passing it is deprecated and will throw aTypeError
in 4.0. -
EventDispatcherDebugCommand::__construct()
now takes an instance ofSymfony\Component\EventDispatcher\EventDispatcherInterface
as first argument. Not passing it is deprecated and will throw aTypeError
in 4.0. -
RouterDebugCommand::__construct()
now takes an instance ofSymfony\Component\Routing\RouterInteface
as first argument. Not passing it is deprecated and will throw aTypeError
in 4.0. -
RouterMatchCommand::__construct()
now takes an instance ofSymfony\Component\Routing\RouterInteface
as first argument. Not passing it is deprecated and will throw aTypeError
in 4.0. -
TranslationDebugCommand::__construct()
now takes an instance ofSymfony\Component\Translation\TranslatorInterface
as first argument. Not passing it is deprecated and will throw aTypeError
in 4.0. -
TranslationUpdateCommand::__construct()
now takes an instance ofSymfony\Component\Translation\TranslatorInterface
as first argument. Not passing it is deprecated and will throw aTypeError
in 4.0. -
AssetsInstallCommand
,CacheClearCommand
,CachePoolClearCommand
,EventDispatcherDebugCommand
,RouterDebugCommand
,RouterMatchCommand
,TranslationDebugCommand
,TranslationUpdateCommand
,XliffLintCommand
andYamlLintCommand
classes have been marked as final -
The
Symfony\Bundle\FrameworkBundle\Translation\PhpExtractor
class has been deprecated and will be removed in 4.0. Use theSymfony\Component\Translation\Extractor\PhpExtractor
class instead. -
The
Symfony\Bundle\FrameworkBundle\Translation\PhpStringTokenParser
class has been deprecated and will be removed in 4.0. Use theSymfony\Component\Translation\Extractor\PhpStringTokenParser
class instead.
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. -
The
Symfony\Component\HttpFoundation\Session\Storage\Proxy\AbstractProxy
class has been deprecated and will be removed in 4.0. Use your\SessionHandlerInterface
implementation directly. -
The
Symfony\Component\HttpFoundation\Session\Storage\Proxy\NativeProxy
class has been deprecated and will be removed in 4.0. Use your\SessionHandlerInterface
implementation directly. -
The
Symfony\Component\HttpFoundation\Session\Storage\Proxy\SessionHandlerProxy
class has been deprecated and will be removed in 4.0. Use your\SessionHandlerInterface
implementation directly. -
NativeSessionStorage::setSaveHandler()
now takes an instance of\SessionHandlerInterface
as argument. Not passing it is deprecated and will throw aTypeError
in 4.0. -
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.
HttpKernel
-
Bundle inheritance has been deprecated.
-
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:
# app/config/services.yml services: # ... # implicit registration of all commands in the `Command` folder
After:
# app/config/services.yml services: # ... # explicit commands registration AppBundle\Command: resource: '../../src/AppBundle/Command/*' tags: ['console.command']
-
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 thecache:clear
command. -
The
Symfony\Component\HttpKernel\Config\EnvParametersResource
class has been deprecated and will be removed in 4.0. -
Implementing
DataCollectorInterface
without areset()
method has been deprecated and will be unsupported in 4.0. -
Implementing
DebugLoggerInterface
without aclear()
method has been deprecated and will be unsupported in 4.0. -
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()
andsetWarmers()
methods have been deprecated and will be removed in 4.0, inject the list of clearers as a constructor argument instead. -
The
CacheWarmerAggregate
andChainCacheClearer
classes have been made final.
Process
- The
Symfony\Component\Process\ProcessBuilder
class has been deprecated, use theSymfony\Component\Process\Process
class directly instead.
Profiler
- The
profiler.matcher
option has been deprecated.
Security
-
Deprecated the HTTP digest authentication:
NonceExpiredException
,DigestAuthenticationListener
andDigestAuthenticationEntryPoint
will be removed in 4.0. Use another authentication system likehttp_basic
instead. -
The
GuardAuthenticatorInterface
has been deprecated and will be removed in 4.0. UseAuthenticatorInterface
instead.
SecurityBundle
-
Using voters that do not implement the
VoterInterface
is now deprecated in theAccessDecisionManager
and this functionality will be removed in 4.0. -
FirewallContext::getListeners()
now returns\Traversable|array
-
InitAclCommand::__construct()
now takes an instance ofDoctrine\DBAL\Connection
as first argument. Not passing it is deprecated and will throw aTypeError
in 4.0. -
The
acl:set
command has been deprecated along with theSetAclCommand
class, both will be removed in 4.0. Install symfony/acl-bundle instead -
The
init:acl
command has been deprecated along with theInitAclCommand
class, both will be removed in 4.0. Install symfony/acl-bundle and useacl:init
instead -
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. -
Deprecated the HTTP digest authentication:
HttpDigestFactory
will be removed in 4.0. Use another authentication system likehttp_basic
instead. -
Deprecated setting the
switch_user.stateless
option to false when the firewall isstateless
. Setting it to false will have no effect in 4.0. -
Not configuring explicitly the provider on a firewall is ambiguous when there is more than one registered provider. 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.
Translation
-
Symfony\Component\Translation\Writer\TranslationWriter::writeTranslations
has been deprecated and will be removed in 4.0, useSymfony\Component\Translation\Writer\TranslationWriter::write
instead. -
Passing a
Symfony\Component\Translation\MessageSelector
toTranslator
has been deprecated. You should pass a message formatter insteadBefore:
use Symfony\Component\Translation\Translator; use Symfony\Component\Translation\MessageSelector; $translator = new Translator('fr_FR', new MessageSelector());
After:
use Symfony\Component\Translation\Translator; use Symfony\Component\Translation\Formatter\MessageFormatter; $translator = new Translator('fr_FR', new MessageFormatter());
TwigBridge
-
deprecated the
Symfony\Bridge\Twig\Form\TwigRenderer
class, use theFormRenderer
class from the Form component instead -
deprecated
Symfony\Bridge\Twig\Command\DebugCommand::set/getTwigEnvironment
and the ability 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 theDebugCommand
class from the Twig bridge instead -
deprecated relying on the
ContainerAwareInterface
implementation forSymfony\Bundle\TwigBundle\Command\LintCommand
Validator
- Not setting the
strict
option of theChoice
constraint totrue
is deprecated and will throw an exception in Symfony 4.0.
Yaml
-
the
Dumper
,Parser
, andYaml
classes are marked as final -
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:
!php/const:PHP_INT_MAX
After:
!php/const PHP_INT_MAX
-
Support for the
!str
tag is deprecated, use the!!str
tag instead. -
Using the non-specific tag
!
is deprecated and will have a different behavior in 4.0. Use a plain integer or!!float
instead. -
Using the
Yaml::PARSE_KEYS_AS_STRINGS
flag is deprecated as it will be removed in 4.0.Before:
$yaml = <<<YAML null: null key true: boolean true 2.0: float key YAML; Yaml::parse($yaml, Yaml::PARSE_KEYS_AS_STRINGS);
After:
$yaml = <<<YAML "null": null key "true": boolean true "2.0": float key YAML; Yaml::parse($yaml);