Change record status: 
Project: 
Introduced in branch: 
9.5.x
Introduced in version: 
9.5.9
Description: 

In a route_callbacks callback modules are able to define non-scalar route defaults.

For example

$route = new Route(
  '/' . $path . '/{extra}',
  [
    '_title' => isset($item['title']) ? $item['title'] : 'CiviCRM',
    '_controller' => 'Drupal\civicrm\Controller\CivicrmController::main',
    'args' => explode('/', $path),
  ],
);

with a corresponding

class CivicrmController {

  function main(array $args,...
}

If a menu link content points to this route, an array default like in this example can cause unpredictable results while objects will simply cause a fatal error.

To avoid this, the key for non scalar defaults now needs to start with an underscore and change the appropriate variable name on the controller method arguments:

$route = new Route(
  '/' . $path . '/{extra}',
  [
    '_title' => isset($item['title']) ? $item['title'] : 'CiviCRM',
    '_controller' => 'Drupal\civicrm\Controller\CivicrmController::main',
    '_args' => explode('/', $path),

and accordingly

class CivicrmController {

  function main(array $_args, ...
}
Impacts: 
Module developers