UPGRADE-8.1.md
Symfony 8.1 is a minor release. According to the Symfony release process, there should be no significant
backward compatibility breaks. Minor backward 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.
If you're upgrading from a version below 8.0, follow the 8.0 upgrade guide first.
object support to input options and arguments' default by changing the $default type to mixed in InputArgument, InputOption, #[Argument] and #[Option]$format argument to SymfonyStyle::createProgressBar(), SymfonyStyle::progressStart(), and SymfonyStyle::progressIterate() to allow passing a custom ProgressBar format stringInputArgument::REQUIRED and InputArgument::OPTIONAL modes to InputArgument constructorInputOption::VALUE_NONE, InputOption::VALUE_REQUIRED and InputOption::VALUE_OPTIONAL modes to InputOption constructoralias, parent, synthetic, file, arguments, properties, configurator or calls when using from_callable#[AsTaggedItem] attribute instead#[Target]
public function __construct(
+ #[Target]
private StorageInterface $imageStorage,
) {
$aliasMap in RegisterMappingsPass. Namespace aliases are no longer supported in Doctrine.LIBXML_NONET in Crawler::addXmlContent() so external entities cannot trigger network requests$deprecationsNamespacesMapping to DebugClassLoader::enable() to configure namespace-to-vendor remapping for deprecation checksValidatorExtension and FormTypeValidatorExtension's constructors; pass a ViolationMapperInterface instead$violationMapper to ValidatorExtensionTrait and TypeTestCase's getExtensions() methodsFilesystem::mirror() with option copy_on_windows, use option follow_symlinks insteadDeprecate setting the framework.profiler.collect_serializer_data config option
Deprecate the framework.http_cache.terminate_on_cache_hit config option
Deprecate parameters router.request_context.scheme and router.request_context.host;
use the router.request_context.base_url parameter or the framework.router.default_uri config option instead
Deprecate setting framework.http_client.default_options.caching.max_ttl to null, use a positive integer instead
Deprecate senders nesting level for messenger routing config; use string or a list of strings instead
Deprecate registering console commands by overriding Bundle::registerCommands(), use the #[AsCommand] attribute or the console.command service tag instead
Deprecate calling FrameworkExtension::load() directly without first loading ServicesBundle's extension. Tests that wire up a ContainerBuilder by hand should now do:
+new ServicesBundle()->getContainerExtension()->load([], $container);
new FrameworkExtension()->load($config, $container);
For real kernels, FrameworkBundle carries a #[RequiredBundle(ServicesBundle::class)] attribute that should be processed already.
null as $maxTtl to CachingHttpClient, pass a positive integer insteadRequest and Response objects directly; use setters or constructor arguments insteadParameterBag::getInt() and ParameterBag::getBoolean() now throw UnexpectedValueException instead of silently returning 0/false when the value cannot be convertedDeprecate BundleInterface, use the one from the DependencyInjection component instead
Deprecate MergeExtensionConfigurationPass, use the one from the DependencyInjection component instead
Deprecate FileLocator, use the one from the DependencyInjection component instead
Deprecate ServicesResetter, ServicesResetterInterface, and ResettableServicePass, use the ones from the DependencyInjection component instead
Deprecate passing a non-flat list of attributes to Controller::setController()
Deprecate the Symfony\Component\HttpKernel\DependencyInjection\Extension class, use the parent Symfony\Component\DependencyInjection\Extension\Extension class instead:
- use Symfony\Component\HttpKernel\DependencyInjection\Extension;
+ use Symfony\Component\DependencyInjection\Extension\Extension;
class ExampleExtension extends Extension
{
// ...
}
Deprecate passing a ControllerArgumentsEvent to the ViewEvent constructor; pass a ControllerArgumentsMetadata instead
Deprecate Bundle::registerCommands(), use the #[AsCommand] attribute or the console.command service tag instead of overriding this method
Envelope<MessageDecodingFailedException> on decode failure instead of throwing;
custom serializers that still throw are supported via a BC fallback in receivers$fetchSize to ReceiverInterface::get() and QueueReceiverInterface::getFromQueues()StopWorkerOnTimeLimitListener in favor of using the time_limit worker optionforceRetry() method to RecoverableExceptionInterfacegetParentRoleNames() method to RoleHierarchyInterfaceRoleHierarchyInterface::getReachableRoleNames() return roles as both keys and valuesSameOriginCsrfTokenManager::onKernelResponse(), SameOriginCsrfTokenManager::clearCookies() and SameOriginCsrfTokenManager::persistStrategy(); this logic is now handled automatically by SameOriginCsrfListener$eraseCredentials argument to AuthenticatorManager::__construct(), as the eraseCredentials() method was removed in Symfony 8.0security.erase_credentials config option and the security.authentication.manager.erase_credentials container parameter, as the eraseCredentials() method was removed in Symfony 8.0Symfony\Component\Serializer\Exception\NotNormalizableValueException will be thrown when a date could not be parsed using the default formatPartialDenormalizationException::__construct($data, array $errors) to __construct(mixed $data, array $notNormalizableErrors, array $extraAttributesErrors = [])PartialDenormalizationException::getErrors(), use getNotNormalizableValueErrors() instead$format to Ulid::isValid()Deprecate ConstraintValidatorInterface::initialize() and ConstraintValidatorInterface::validate() in
favor of ConstraintValidatorInterface::validateInContext(). The ConstraintValidator abstract class
handles the context management when extending it. When writing tests with ConstraintValidatorTestCase,
use the new validate method to abstract the way to use the constraint validator.
| Your code | Action required |
|---|---|
extends ConstraintValidator | Nothing to do |
implements ConstraintValidatorInterface directly | Implement validateInContext() |
tests using ConstraintValidatorTestCase | Call $this->validate() instead of $this->validator->validate() |
Implementing ConstraintViolationListInterface without implementing findByCodes() is deprecated
Hydrator and Instantiator classes, use deepclone_hydrate() from the deepclone extension instead