[REF][PHP8.1] Fix deprecation notice on passing NULL as the 3rd param to str_replace...
authorfrancescbassas <francesc@babu.cat>
Mon, 2 Oct 2023 08:40:38 +0000 (10:40 +0200)
committerGitHub <noreply@github.com>
Mon, 2 Oct 2023 08:40:38 +0000 (10:40 +0200)
CRM/Utils/Geocode/Google.php

index 247a54109600316dc24258fb259eb6d925e4c779..abab6b313ae66f9159bcd7023856abbc5a01983c 100644 (file)
@@ -66,7 +66,7 @@ class CRM_Utils_Geocode_Google {
 
     if (!empty($values['state_province']) || (!empty($values['state_province_id']) && $values['state_province_id'] != 'null')) {
       if (!empty($values['state_province_id'])) {
-        $stateProvince = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_StateProvince', $values['state_province_id']);
+        $stateProvince = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_StateProvince', $values['state_province_id']) ?? '';
       }
       else {
         if (!$stateName) {
@@ -74,10 +74,10 @@ class CRM_Utils_Geocode_Google {
             $values['state_province'],
             'name',
             'abbreviation'
-          );
+          ) ?? '';
         }
         else {
-          $stateProvince = $values['state_province'];
+          $stateProvince = $values['state_province'] ?? '';
         }
       }