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

CRM-19813 - Only dispatch through EventDispatcher after booting #10138

Merged
merged 1 commit into from
Apr 11, 2017

Conversation

totten
Copy link
Member

@totten totten commented Apr 11, 2017

After merging #9949, some screens (like the contact-result list or "View
Contact") reported warnings like:

Notice: Undefined index: in CRM_Core_BAO_Country::countryLimit() (line 90 of /home/foo/buildkit/build/dmaster/sites/all/modules/civicrm/CRM/Core/BAO/Country.php).
Notice: Undefined index: in CRM_Core_BAO_Country::provinceLimit() (line 62 of /home/foo/buildkit/build/dmaster/sites/all/modules/civicrm/CRM/Core/BAO/Country.php).

Bisecting the git history revealed that it stemmed from switching
hook_civicrm_entityTypes to go through EventDispatcher.

fb1d9ad#diff-8869a8f3c6318eb0580ce2aa04b713bfL1835

This hook is apparently similar to hook_civicrm_container in that both
fire pre-boot. If we attempt to dispatch it through the container in a
pre-boot environment, something initializes incorrectly.

This change proposes a general rule:

  • If you fire a hook before the container or EventDispatcher is available...
  • Then don't try to use the container or EventDispatcher.

After merging civicrm#9949, some screens (like the contact-result list or "View
Contact") reported warnings like:

```
Notice: Undefined index: in CRM_Core_BAO_Country::countryLimit() (line 90 of /home/foo/buildkit/build/dmaster/sites/all/modules/civicrm/CRM/Core/BAO/Country.php).
Notice: Undefined index: in CRM_Core_BAO_Country::provinceLimit() (line 62 of /home/foo/buildkit/build/dmaster/sites/all/modules/civicrm/CRM/Core/BAO/Country.php).
```

Bisecting the git history revealed that it stemmed from switching
`hook_civicrm_entityTypes` to go through EventDispatcher.

civicrm@fb1d9ad#diff-8869a8f3c6318eb0580ce2aa04b713bfL1835

This hook is apparently similar to `hook_civicrm_container` in that both
fires pre-boot.  If we attempt to dispatch it through the container in a
pre-boot environment, something initializes incorrectly.

This change proposes a general rule:
 * If you fire a hook before the container or EventDispatcher is available...
 * Then don't try to use the container or EventDispatcher.
@eileenmcnaughton
Copy link
Contributor

looks good - hopefully it will work for my query mod dispatcher - which didn't quite fire before

@eileenmcnaughton eileenmcnaughton merged commit 01d1467 into civicrm:master Apr 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants