Closed daltonrooney closed 2 years ago
I'm not able to reproduce that, so it's likely due to a conflict with some other plugin (or a custom module) installed on your end.
You're probably right that this is the same issue as https://github.com/craftcms/cms/issues/2473 (and the one you linked, which is basically the same problem – i.e. https://github.com/craftcms/cms/issues/11033).
I just cut a release 1.4.5 that changes the event MatrixMate listens to from Plugins::EVENT_AFTER_LOAD_PLUGINS
to Application::EVENT_INIT
– just because that seems to be the official best practice since https://github.com/craftcms/cms/commit/50f6d35d4d8297d8f7e961f498d8301805c8a06f (and also because MatrixMate 2, for Craft 4, is already using that event, so – consistency :)
FYI though, both of these events should actually be safe to use in terms of avoiding the actual problem described in the issues linked. From a core perspective, the EVENT_INIT
event is literally triggered right after the PLUGINS_LOADED
event – so if this actually solves your issue, this is most likely coincidental, i.e. you most likely have something in your stack that triggers a user element query outside of bounds. Upgrading your site to Craft 4 will likely expose that something, since Craft 4 will log a warning for it.
Thanks for the detailed background info and pushing a fix so quickly! We’ll be moving this site to Craft 4.1 before the end of the summer but we did deactivate all plugins as part of our testing process before I submitted this so that’s still a mystery.
@daltonrooney What about custom modules?
@mmikkel Yep, just found it, a call to Craft::$app->getUser()->getIdentity();
in a custom module's init() method. Thanks for the tip! 🙌🏻
@daltonrooney Right on, thanks for the follow-up!
I'm not sure exactly when this started, but it appears that MatrixMate assets aren't loading in the CP in recent versions of 3.7. Possibly related? https://github.com/craftcms/cms/issues/11033#issuecomment-1111836993
Craft::$app->getUser()->checkPermission('accessCp')
always returns false in theonAfterLoadPlugins()
method. Changing the event that loads that method toApplication::EVENT_INIT
does seem to solve the problem.