-
-
Notifications
You must be signed in to change notification settings - Fork 824
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
dev/core#2425 - php 7.4 - E_NOTICE every time you save a contribution #19978
Conversation
(Standard links)
|
} | ||
if (!empty($items)) { | ||
$lineItems[] = $items; | ||
if (!empty($orderLineItems)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need the if (!empty ) here - I feel like it has carried over from the original but I suspect it is no longer needed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I change the function signature to default [] instead of null then I think that would be ok, since then the loop won't choke iterating over null.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah - it looks like the only 'live' call to this would always pass an array but the test calls don't
@@ -399,15 +399,8 @@ public static function checkFinancialTypeHasDeferred($params, $contributionID = | |||
$financialTypeID = $params['prevContribution']->financial_type_id; | |||
} | |||
if (($contributionID || !empty($params['price_set_id'])) && empty($lineItems)) { | |||
if (!$contributionID) { | |||
CRM_Price_BAO_PriceSet::processAmount($priceSetFields, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel so happy seeing the demise of this line
5de4330
to
bd4fe93
Compare
Tested on test build http://core-19978-75go.test-1.civicrm.org:8001/ (cred - admin / aPshklfG1cPf), on contribution back office form, encountered no regression or breakage. Reviewed the patch looks good to me. Added unit-test passed on php 7.4 on my local m/c. Hence merging the PR |
Thanks! @monishdeb |
Overview
https://lab.civicrm.org/dev/core/-/issues/2425
Before
Notice: Trying to access array offset on value of type null in CRM_Contribute_Form_Contribution::formRule() (line 915 of CRM\Contribute\Form\Contribution.php).
After
No notice.
If you want to check that the financial account validation is still working you can:
Technical Details
See lab ticket. The gist is to not calculate the line items from the
_priceSet
variable which is missing and instead get the line items from the order and pass it in.In terms of the affected scope:
So the scope is pretty limited. It might miss the validation warning if for some reason the order'ized version of the line items is somehow different than before. I don't know enough about it so I'm just assuming it always matches up.
I'm sure there is more here to clean up but I really just want the problem to go away since it comes up every single time you save a contribution.
Comments
Has test. Note it passes on php 7.3 or lower even before the patch, but fails on php 7.4.