Problem/Motivation

A PHP deprecation notice is triggered by OpenIdConnectSessionTest::testSaveDestinationUserPath():

1 test triggered 1 PHP deprecation:

1) /var/www/html/modules/contrib/openid_connect/src/OpenIDConnectSession.php:102
ltrim(): Passing null to parameter #1 ($string) of type string is deprecated

Triggered by:

* Drupal\Tests\openid_connect\Unit\OpenIdConnectSessionTest::testSaveDestinationUserPath
  /var/www/html/modules/contrib/openid_connect/tests/src/Unit/OpenIdConnectSessionTest.php:147

Eventually this will cause an error when the module is tested on PHP 9. It's caused by OpenIDConnectSession::saveDestination() trying to build a URL for the user.login route.

Steps to reproduce

See the most recent max PHP version pipeline: https://git.drupalcode.org/project/openid_connect/-/jobs/3855616.

Proposed resolution

The OpenIdConnectSessionTest::testSaveDestination() test gets around this by mocking the route. A quick fix is to do the same mocking in testSaveDestinationUserPath(). But a more appropriate fix might be to check for the existence of the route in saveDestination() or to simply add the User module as a dependency. I'll submit an MR for the quick fix and leave it up to the maintainers to decide whether they want to bother making the code more robust.

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

dcam created an issue. See original summary.

dcam’s picture

Status: Active » Needs review

The max-PHP version PHPUnit test comes back green with this MR.

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

pfrilling’s picture

Status: Needs review » Reviewed & tested by the community

Looks good to me. I merged the 3.x branch to confirm the pipeline completes.

pfrilling’s picture

Status: Reviewed & tested by the community » Fixed

All pipelines green! Started the merge train.

  • pfrilling committed 566df6ac on 3.x authored by dcam
    Issue #3498837 by dcam, pfrilling: PHP deprecation triggered by...

Status: Fixed » Closed (fixed)

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

joseph.olstad’s picture

Alpha6 causes an issue in keycloak reported by two others

I'm not sure which change in alpha6 is causing this.

pfrilling’s picture

Remove unrelated linked issue.