Skip to content

Upgrading symfony/routing 7 to 8

Breakingv7.4.24 → v8.1.12Breaking12Security10Platform1Deprecated3New9Changed2Fixed27

BreakingUpgrade verdict

12 breaking changes and a platform requirement change and 10 security fixes.

  • Routing can no longer be configured with XML files; use another supported format such as PHP, YAML or attributes.
  • Configuration files can no longer use the fluent PHP style; use arrays instead.
  • PHP config files can no longer use $this or the loader's internals.
  • XML config files are no longer supported; use PHP or YAML instead.
Top 5 of 26 that need code or config changes

PHP requirement changed in v8.1.0-BETA1: >=8.2 → >=8.4.1.

Breaking12
Removes support for the XML configuration format.
Removes support for the fluent PHP config format in Config and DependencyInjection.
Removes the ability to access $this and the loader's internal state in Config, DependencyInjection and Routing config.
$this
Removes support for the XML configuration format in DependencyInjection and Routing.
Removes annotation aliases and getters and setters in favor of public properties on attributes in Routing and Serializer.
Removes support for accessing the internal scope of the loader in PHP config files; use only its public API instead.
Providing a non-array _query parameter to UrlGenerator now causes an InvalidParameterException.
UrlGenerator_queryInvalidParameterException
Removes the protected AttributeClassLoader::$routeAnnotationClass property and setRouteAnnotationClass(), use AttributeClassLoader::setRouteAttributeClass() instead.
AttributeClassLoader::$routeAnnotationClassAttributeClassLoader::setRouteAnnotationClass()AttributeClassLoader::setRouteAttributeClass()
Removes class aliases in the Annotation namespace; use attributes instead.
Annotation
Removes getters and setters in attribute classes in favor of public properties.
Removes the deprecated getEnv and setEnv methods from Routing.
getEnvsetEnv
Removes the deprecated AttributeClassLoader property and setter in Routing.
AttributeClassLoader
Security10
Rejects host parameters that contain forbidden characters.
Prevents generated URLs from pointing to another host.
Prevents router redirects from sending paths starting with // to another host.
Prevents host placeholders from matching the path in compiled matchers.
Marks this as a security release.
Fixes dot-segment encoding for chained "../" and "./" in generated URLs.
Fixes regex alternation anchoring in UrlGenerator requirement validation.
UrlGenerator
Fixes dot-segment encoding for chained "../" and "./" sequences in generated URLs.
Moderate
Hardens __unserialize against __toString trampolines.
__unserialize__toString
Fixes regex alternation anchoring in UrlGenerator requirement validation (CVE-2026-45065).
UrlGeneratorModerate
Platform1
Bumps Symfony 8 to require PHP >= 8.4.
Deprecated3
Deprecates the XML configuration format in DependencyInjection and Routing.
Deprecates using $this or the internal scope of the loader from PHP config files in Config, DependencyInjection and Routing.
$this
Deprecates annotation aliases and getters and setters in favor of public properties on attributes in Routing and Serializer.