Change record status: 
Project: 
Introduced in branch: 
9.1.x
Introduced in version: 
9.1.0
Description: 

This following methods are deprecated with no replacement.

  • getDefaults()
  • getRequirements()
  • getRequirements()

The workaround used by the reporter of issue needs to compile a route like so:

$route = new \Symfony\Component\Routing\Route('/');
\Drupal\Core\Routing\RouteCompiler::compile($route)->getDefaults();

The second line works with a CompiledRoute object, and the CompiledRoute object has three methods that could never have worked, because these methods assume that the $route property was injected or inherited, and neither of these things are true.

This is an unusual bug, because it allows the caller to dynamically inject an object of any type with an implied interface into the class.

Impacts: 
Module developers
Site templates, recipes and distribution developers