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 reference to undefined variable #22839

Merged
merged 1 commit into from
Feb 26, 2022

Conversation

braders
Copy link
Contributor

@braders braders commented Feb 26, 2022

Overview

In CRM_Price_BAO_PriceFieldValue::add, $fieldValueBAO->id was read before $fieldValueBAO is defined; this can obviously not work.

The variable was defined prior to commit 50a890f 2 years ago, which swapped the order of operations. This change restores the original order of operations, but ensures that the default is set correctly. See #17960 for more context for the original problem from 2 years prior.

This only impacts extensions which might be using CRM_Price_BAO_PriceFieldValue; core calls to CRM_Price_BAO_PriceFieldValue::add always pass in the price_field_id meaning the faulty code was never reached.

@civibot
Copy link

civibot bot commented Feb 26, 2022

(Standard links)

@civibot civibot bot added the master label Feb 26, 2022
@braders braders force-pushed the pricefieldvalue-undefined-var branch from 81d4864 to 570544d Compare February 26, 2022 17:51
@demeritcowboy
Copy link
Contributor

Thanks @braders. It's interesting that core would always pass price_field_id since I would guess the use-case for it being missing would be contribution page amounts with no explicit price sets (quick_config magic price set), but it must take the "slow" route.

@demeritcowboy demeritcowboy merged commit e4339d1 into civicrm:master Feb 26, 2022
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