Closed (fixed)
Project:
Pathauto
Version:
8.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
28 Jun 2022 at 23:06 UTC
Updated:
30 Jul 2022 at 13:54 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
ada hernandez commentedAdding a patch to remove the ModuleHandler::getImplementations() deprecation.
Comment #3
berdirThanks, there are two issues with it:
a), we need to keep both versions, to support 9.3 still. See the patch in #3278537: D10 compatibility | Declaration of Drupal\field_group\Routing\RouteSubscriber::getSubscribedEvents() must be compatible with Drupal\Core\Routing\RouteSubscriberBase::getSubscribedEvents(), check core version, then do one or the other.
b) I don't think this is working. You are now inside a nested function, that return TRUE/FALSE is not going anywhere. seems like we don't have test coverage of this? We need to have a by reference variable that we set to TRUE/FALSE and then return that. Also no need to make $results an array. And to keep the optimization, we need to check if $result is already TRUE and skip the call then, so:
Comment #4
s_bhandari commentedHi,
Patch added for the same. Please review.
Thanks.
Comment #5
s_bhandari commentedComment #6
berdirthis stores the return in a results array but then uses it as a boolean. you need to assign to $results directly.
Also, you can't return anymore, you're inside a function, it goes nowhere. you need to use (&$result) so that the result if it can be returned.
Comment #7
benjifisherI think you are referring to #3278537: D10 compatibility | Declaration of Drupal\field_group\Routing\RouteSubscriber::getSubscribedEvents() must be compatible with Drupal\Core\Routing\RouteSubscriberBase::getSubscribedEvents(). I am adding that as a related issue.
I plan to work on this today. If I forget to un-assign myself, feel free to reassign after that.
Comment #8
benjifisherHere is a patch that implements the solution proposed in the issue summary.
I am not providing an interdiff, since this is a different approach from the earlier patches.
Comment #9
benjifisherHere is a patch that implements yet another approach. This should work the same way with both Drupal 10 (tested) and 9.3 (untested).
Comment #10
berdirInteresting. I guess that works, I do wonder what the performance impact is, getImplementations() is cached and this is likely going to call hasImplementations() 100+ times on sites with many modules. And most sites won't actually have an implementation of this hook.
So I'll go with #8, we can eventually clean this up and do the check directly in the callback.
Also sneaking in D10 test fixes that didn't fail before.
Comment #12
berdirAh, need to pass in the Url object, forgot that you can do that.
Comment #14
berdirCommitted.