RouteHelper conflicts with some RouteEnhancers

Created on 12 July 2022, over 2 years ago
Updated 3 September 2024, 3 months ago

Problem/Motivation

I've been getting a deprecation notice since upgrading to PHP 8.1 that states:

Deprecated function: stripos(): Passing null to parameter #1 ($haystack) of type string is deprecated in Drupal\graphql\Routing\QueryRouteEnhancer->extractBody() (line 80 of modules/contrib/graphql/src/Routing/QueryRouteEnhancer.php).

I tracked it down to the fact that the RouteEnhancer in the graphQL module is expecting a 'content-type' header which isn't added to the route when \Drupal\route_basic_auth\Routing\RouteHelper rebuilds the current route using

$requestUrlObject = Url::fromUserInput($currentPath);

which doesn't re-attach all the existing headers.

Steps to reproduce

  1. Install and configure this module and graphQL 4.x
  2. Make a graphQL request
  3. Go to any admin page and the error will be visible

Proposed resolution

Is there a particular reason a custom RouteHelper was created instead of using the current_route_match service to get the route name? Using that service doesn't trigger RouteEnhancers.

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Closed: outdated

Version

2.0

Component

Code

Created by

🇦🇺Australia darvanen Sydney, Australia

Live updates comments and jobs are added and updated live.
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