RouteHelper conflicts with some RouteEnhancers

Created on 12 July 2022, almost 2 years ago
Updated 12 June 2024, 14 days 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

Needs review

Version

1.0

Component

Code

Created by

πŸ‡¦πŸ‡ΊAustralia darvanen Sydney, Australia

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