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.
Comments
Comment #2
pfrenssenComment #4
pfrenssenComment #5
czigor commentedLooks like a trivial fix to me.
Comment #6
czigor commentedI haven't tested it manually but since the added test passes we should be fine.
Comment #8
berdirAlso adding to the merge train, another conflict on the webform change ;)