Problem/Motivation

Getting a deprecation warning on PHP 8.3 when running tests:

Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /modules/contrib/tmgmt/translators/tmgmt_local/src/Menu/TMGMTLocalBreadcrumbBuilder.php on line 23

The code in question is this:

    if (strpos($route_match->getRouteName(), 'view.tmgmt_local_manage_translate_task') === 0 || strpos($route_match->getRouteName(), 'view.tmgmt_local_task_overview') === 0 ||
      $route_match->getParameter('tmgmt_local_task') instanceof LocalTaskInterface || $route_match->getParameter('tmgmt_local_task_item') instanceof LocalTaskItemInterface) {
      return TRUE;
    }

It happens because $route_match->getRouteName() can return NULL if there is no route, e.g. when running on the CLI.

Issue fork tmgmt-3537643

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

pfrenssen created an issue. See original summary.

pfrenssen’s picture

Issue summary: View changes

pfrenssen’s picture

Status: Active » Needs review
czigor’s picture

Looks like a trivial fix to me.

czigor’s picture

Status: Needs review » Reviewed & tested by the community

I haven't tested it manually but since the added test passes we should be fine.

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

berdir’s picture

Status: Reviewed & tested by the community » Fixed

Also adding to the merge train, another conflict on the webform change ;)

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

  • berdir committed e0a7a795 on 8.x-1.x authored by pfrenssen
    fix: #3537643 Deprecated: strpos(): Passing null is deprecated in...

Status: Fixed » Closed (fixed)

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