PHP8.1 - prices must be numbers, not strings for arithmetic
authorJon Goldberg <jon@megaphonetech.com>
Fri, 2 Dec 2022 16:22:11 +0000 (11:22 -0500)
committerJon Goldberg <jon@megaphonetech.com>
Fri, 2 Dec 2022 19:50:07 +0000 (14:50 -0500)
CRM/Price/BAO/LineItem.php

index 6399dade3d31585a4b2eaf9e0eb6728f9a12d5b6..b153763e2a6ea15cdf5b41a74b03d8a280e5807a 100644 (file)
@@ -302,9 +302,10 @@ WHERE li.contribution_id = %1";
     }
 
     foreach ($params["price_{$fid}"] as $oid => $qty) {
-      $price = $amount_override === NULL ? $options[$oid]['amount'] : $amount_override;
+      $qty = (int) $qty;
+      $price = (float) ($amount_override === NULL ? $options[$oid]['amount'] : $amount_override);
 
-      $participantsPerField = CRM_Utils_Array::value('count', $options[$oid], 0);
+      $participantsPerField = (int) CRM_Utils_Array::value('count', $options[$oid], 0);
 
       $values[$oid] = [
         'price_field_id' => $fid,