Two new PHP8 issues
Created by: chriscant
We're using uk.co.vedaconsulting.gdpr v3.4. Two new issues have surfaced recently, probably as a result of upgrading to use PHP8.1 from PHP7.4
In CRM/Gdpr/Form/UpdatePreference.php an error is thrown at line 245 array_diff_assoc as $channelArray is not defined in all cases. I fixed this by adding in this after line 233:
$channelArray = [];
In CRM/Gdpr/CommunicationsPreferences/Utils.php an error is thrown ay line 523 array_fill_keys when a new contact is being created. In this case, $apiResult['preferred_communication_method'] is empty so $existingPreferredMethod is a string. I fixed this by adding this in after line 522:
if( gettype($existingPreferredMethod)=="string") $existingPreferredMethod = [];