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

Event Registration: initialize array #22312

Merged
merged 1 commit into from
Dec 24, 2021
Merged

Conversation

mlutfy
Copy link
Member

@mlutfy mlutfy commented Dec 23, 2021

Overview

Minor code nitpick to avoid a PHP fatal on PHP 8.0 in certain unusual circumstances.

Before

Viewing Event Registration page as an organization results in fatal PHP error.

After

Viewing Event Registration page as an organization displays the form, although in a not-very-supported way.

Technical Details

Under PHP 8.0, this throws a fatal error. Previously it only throw a warning:

php -r "array_intersect_key(NULL, []);"

Comments

Sure, it's not a supported use-case, and I stumbled on it by accident, but initializing variables is usually not a bad thing.

@civibot
Copy link

civibot bot commented Dec 23, 2021

(Standard links)

@civibot civibot bot added the master label Dec 23, 2021
@mlutfy
Copy link
Member Author

mlutfy commented Dec 23, 2021

jenkins, test this please

@totten
Copy link
Member

totten commented Dec 24, 2021

Oof, that code has a lot of different branches for initializing $fields. But there does appear to be a gap when $contactID is trueish, $id is not an array, filterUFGroups() is falseish.

Agree this shouldn't change the current behavior - it should just make the outcome on php80 match outcome on php7x.

Tests passing. Merging.

@totten totten merged commit f9b40cb into civicrm:master Dec 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants