Outbound path processors cannot override the specified URL fragment

Created on 24 May 2017, about 7 years ago
Updated 9 March 2023, over 1 year ago

Problem

Through the implementation of an outbound path processor, it is currently impossible to override the $options['fragment'] value and for it to be used in the processed and generated URL.

Steps, expected & actual

  • Implement an outbound path processor that alters the $options['fragment'] value for a URL being generated from a route (note: I have not tested other URL generators with respect to this same problem yet).
  • The expected URL value should include the the specified fragment.
  • The actual URL which is generated does not include the fragment specified in the outbound path processor.

In code

The implementation of Drupal\Core\Routing\UrlGenerator::generateFromRoute(...) determines the $fragment variable value from $options['fragment'] early for its usage on routes which have the _no_path option specified. However, in cases where $options['path_processing'] is true, the processors may alter the $options['fragment'] value but it has no affect on the $fragment within the generateFromRoute(...) method as the altered value is never re-assigned.

🐛 Bug report
Status

Fixed

Version

9.5

Component
Base 

Last updated less than a minute ago

Created by

🇨🇦Canada amcgowanca

Live updates comments and jobs are added and updated live.
Sign in to follow issues

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.69.0 2024