Routematch parameters with multiple values return space instead of +

Created on 2 April 2024, 11 days ago
Updated 3 April 2024, 10 days ago

Problem/Motivation

Steps to reproduce

Please allow me to provide you with a simplified example. you will be able to reproduce the behavior by creating a new view.

- Create a view
- Add a contextual filter and set the option to allow multiple values. This allow to specify multiple ids by separating them using + (E.G. /books/horror+thriller)

- The issue spawn If you try to get the parameters using Routematch class and you have multiple values in url. The + symbol will be overwritten by a space

by using the following code snippet you should obtain "horror+thriller" but instead it will return "horror thriller"
\Drupal::routeMatch()->getParameters()->all()["book_type"]

Proposed resolution

The issue is due to the php urldecode function. As described here the + symbol is decoded to a space character

To fix the issue replace the urldecode function present in web/core/lib/Drupal/Core/PathProcessor/PathProcessorDecode.php with the rawurldecode

πŸ› Bug report
Status

Needs work

Version

11.0 πŸ”₯

Component
RoutingΒ  β†’

Last updated 1 day ago

Created by

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

Sign in to follow issues

Merge Requests

Comments & Activities

Production build https://api.contrib.social 0.62.1