Remove reference to undefined variable #22839
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 toCRM_Price_BAO_PriceFieldValue::add
always pass in theprice_field_id
meaning the faulty code was never reached.