Closed specoto closed 10 months ago
Hi @specoto , please add more details about the issue.
Hi, I have this error on 3.0.2 tag:
Error message Deprecated function: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in Drupal\apigee_edge_teams\EventSubscriber\TeamStatusWarningSubscriber->onRespond() (line 102 of modules/contrib/apigee_edge/modules/apigee_edge_teams/src/EventSubscriber/TeamStatusWarningSubscriber.php).
Basically we need to have a (string) cast to the first strpos() argument on line 102 if ($this->currentUser->isAuthenticated() && strpos((string) $this->routeMatch->getRouteName(), 'entity.team_app.') === 0) {
I don't seem to have rights for PRs do here is the diff: `diff --git a/modules/apigee_edge_teams/src/EventSubscriber/TeamStatusWarningSubscriber.php b/modules/apigee_edge_teams/src/EventSubscriber/TeamStatusWarningSubscriber.php index 8ebf33ad..bace71dc 100644 --- a/modules/apigee_edge_teams/src/EventSubscriber/TeamStatusWarningSubscriber.php +++ b/modules/apigee_edge_teams/src/EventSubscriber/TeamStatusWarningSubscriber.php @@ -99,7 +99,7 @@ class TeamStatusWarningSubscriber implements EventSubscriberInterface { */ public function onRespond(ResponseEvent $event) { // Anonymous user's does not have access to these routes.
Hi @specoto Let us know, the steps to reproduce the error, we will look into it. Please add the page also where the issue is seen.
Also please check CONTRIBUTING.md for knowing the contributing workflow. Thanks!
Hi this happens when apigee_edge_teams module is enabled and PHP 8.1 is installed, the error is visible in recent logs when navigating drupal installation.
Thanks!
Enabled via Drush, right?
My assumption that the current route is only available in the HTML presentation layer, not in others. Therefore $this->routeMatch->getRouteName()
can be null.
Hi @mxr576 after additional debug I see that a rest resource route has been broken (locally )and probably is the cause of this error, however it is still worth adding the cast as prevention and defensive programming. Rector also recommends this approach with a rule: https://github.com/rectorphp/rector/blob/main/rules/Php81/Rector/FuncCall/NullToStrictStringFuncCallArgRector.php
Hi @specoto We tried to replicate the issue by enabling the Apigee Edge teams module from UI as well as via drush, but we don't see mentioned errors on the logs.
Hi @specoto We checked the other way to see the issue. Following are the steps to reproduce-
Please feel free to create the PR and we will review. Also please check CONTRIBUTING.md for knowing the contributing workflow.
Do let us know for any issue. Thanks!