Problem/Motivation

I updated my Docker container to PHP 8 and started getting the error below:

Deprecated: Required parameter $path_processor_language follows optional parameter $filter_protocols in /var/www/html/modules/contrib/trailing_slash/src/Routing/TrailingSlashUrlGenerator.php on line 35
The website encountered an unexpected error. Please try again later.
RuntimeException: Failed to start the session because headers have already been sent by "/var/www/html/modules/contrib/trailing_slash/src/Routing/TrailingSlashUrlGenerator.php" at line 35. in Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage->start() (line 152 of /var/www/vendor/symfony/http-foundation/Session/Storage/NativeSessionStorage.php).

Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage->start() (Line: 164)
Drupal\Core\Session\SessionManager->startNow() (Line: 118)
Drupal\Core\Session\SessionManager->start() (Line: 57)
Symfony\Component\HttpFoundation\Session\Session->start() (Line: 240)
Drupal\big_pipe\Render\BigPipe->performPreSendTasks() (Line: 295)
Drupal\big_pipe\Render\BigPipe->sendContent(Object) (Line: 112)
Drupal\big_pipe\Render\BigPipeResponse->sendContent() (Line: 381)
Symfony\Component\HttpFoundation\Response->send() (Line: 20)

This can be fixed by removing the default values from $filter_protocols. There can't be default values on parameters that precede a parameter without a default value.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

smulvih2 created an issue. See original summary.

smulvih2’s picture

Status: Active » Needs review
StatusFileSize
new686 bytes

Patch fixes the issue using PHP 8.0.12.

michael.acampora’s picture

The patch in #2 overwrites the default values of the extended class "UrlGenerator", this could lead to potential issue's. I think it's better to just add a default value to the added parameter "$path_processor_language" to fix the deprecation issue.

This argument is added in the "Drupal\trailing_slash\TrailingSlashServiceProvider" class.

parisek made their first commit to this issue’s fork.

parisek’s picture

Title: TrailingSlashUrlGenerator issue with PHP 8 » TrailingSlashUrlGenerator deprecated issue with PHP 8
Status: Needs review » Reviewed & tested by the community

Opened MR with patch from mike.vindicate, working great for me, RTBC

AstonVictor made their first commit to this issue’s fork.

astonvictor’s picture

Status: Reviewed & tested by the community » Fixed

Merged the MR.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.