Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FYI on related issue triggered by Admin Utilties #33

Open
awestuk opened this issue Jun 4, 2022 · 3 comments
Open

FYI on related issue triggered by Admin Utilties #33

awestuk opened this issue Jun 4, 2022 · 3 comments

Comments

@awestuk
Copy link

awestuk commented Jun 4, 2022

This isn't a problem with AU, which seems to do everything correctly, but just an FYI that both AU and Profile Sync are triggering a process that causes an error when CiviRules is installed:

https://lab.civicrm.org/extensions/civirules/-/issues/175

Doesn't seem to be CiviRules either - looks like more of a Core issue: the mysterious sometimes-extension-classes-don't-load-properly issue that comes up on Mattermost from time to time. But as it's triggered when AU is in place I figured people might mention it.

It's at least replicable! Trying to dig into it here.

@christianwach
Copy link
Owner

@awestuk Interesting - thanks for the report.

Looks to me from the backtrace in the Lab ticket that calling civi_wp()->initialize() in a callback from civicrm_config triggers the issue. Since the CiviCRM_For_WordPress_Admin::initialize() method hasn't completed before being called again, the static variable hasn't been set and it cannot return early.

Having said that, the ClassLoader should have been set up in the first call (i.e. before it reaches $config = CRM_Core_Config::singleton();) so there's a bit of a conundrum:

  • Should plugins be prevented from checking if CiviCRM is initialised before proceeding during that callback?
  • Or should CiviCRM-WordPress recognise a recursive call in CiviCRM_For_WordPress_Admin::initialize() and bail early?
  • And if the latter, should the return value be true or false? Is CiviCRM initialised or not at that point?

I can remove those checks from my plugins to avoid the issue in the short term, but the issue will remain dormant unless it's also addressed in CiviCRM-WordPress. This could be as simple as checking doing_action( 'civicrm_config' ) but see the final bullet point above. Perhaps documentation and prevention is a better route?

@christianwach
Copy link
Owner

@awestuk I've removed the initialized() checks from civicrm_config callbacks in this plugin and in CiviCRM Profile Sync. Let me know if they help. I'll release new versions on the WordPress Plugin Directory in due course.

@awestuk
Copy link
Author

awestuk commented Jun 9, 2022

That sounds a knotty problem, but a sensible workaround! I'll test asap.

This and its PR look potentially relevant, although it's a different error message: https://lab.civicrm.org/dev/core/-/issues/3502

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants