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

Remove use of nullArray in delete hooks #19059

Merged

Conversation

eileenmcnaughton
Copy link
Contributor

@eileenmcnaughton eileenmcnaughton commented Nov 27, 2020

Overview

Cleanup on delete pre hooks

Before

nullArray being passed around

After

$params not passed if it does not exist

Technical Details

Looking at #18995 I was struck by the delete hook being non-standard. In general we don't load from the DB just to pass
to the hook as the hook can do that itself. However, when I looked at other hooks
I found that they were passing out nullArray - this is a legacy method that precedes
being on a php version that supported default params when passing by reference.

It's further known to introduce intermittent hard to debug issues. This adds the new hook
and also adds standardisation to the other hooks for pre+delete.

I've left the create one for now but GroupContact is a good example of something
close to what we want to standardise on there

Comments

Looking at civicrm#18995 I was struck by the delete hook being non-standard. In general we don't load from the DB just to pass
to the hook as the hook can do that itself. However, when I looked at other hooks
I found that they were passing out nullArray - this is a legacy method that precedes
being on a php version that supported default params when passing by reference.

It's further known to introduce intermittent hard to debug issues. This adds the new hook
and also adds standardisation to the other hooks for pre+delete.

I've left the create one for now but GroupContact is a good example of something
close to what we want to standardise on there
@civibot
Copy link

civibot bot commented Nov 27, 2020

(Standard links)

@colemanw
Copy link
Member

Lots of test coverage here.

@colemanw colemanw merged commit 1bc5c7a into civicrm:master Nov 27, 2020
@eileenmcnaughton eileenmcnaughton deleted the 2199_ufgroup_pre_post_hook branch November 27, 2020 19:51
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