Route "_title_arguments" computation may be incorrect

Created on 13 September 2019, almost 5 years ago
Updated 30 July 2024, about 1 month ago

API page: https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Controlle...

The code for getting the arguments for the route in TitleResolver.php file in getTitle() is as follows:

      $args = [];
      if (($raw_parameters = $request->attributes->get('_raw_variables'))) {
        foreach ($raw_parameters->all() as $key => $value) {
          $args['@' . $key] = $value;
          $args['%' . $key] = $value;
        }
      }
      if ($title_arguments = $route->getDefault('_title_arguments')) {
        $args = array_merge($args, (array) $title_arguments);
      }

Here '_title_arguments' are the arguments specified in the routing file, which IMO, should be the default value in case "_raw_variables" are not there.

So IMO, the array_merge() should be:
array_merge((array) $title_arguments, $args);

🐛 Bug report
Status

Needs work

Version

11.0 🔥

Component
Routing 

Last updated 8 days ago

Created by

🇮🇳India Vivek Panicker Kolkata

Live updates comments and jobs are added and updated live.
  • Needs issue summary update

    Issue summaries save everyone time if they are kept up-to-date. See Update issue summary task instructions.

Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024