After updating your WordPress website to PHP 8 you may be getting flooded with emails informing you about this error message:
An error of type E_ERROR was caused in line 42 of the file /www/wp-content/plugins/official-facebook-pixel/vendor/facebook/php-business-sdk/src/FacebookAds/Object/ServerSide/Normalizer.php. Error message: Uncaught TypeError: strlen(): Argument #1 ($string) must be of type string, array given in /www/wp-content/plugins/official-facebook-pixel/vendor/facebook/php-business-sdk/src/FacebookAds/Object/ServerSide/Normalizer.php:42
This is a problem with the plugin itself that was helpfully fixed by GitHub user Invader444 here.
The solution was apparently to goto the “core/ServerEventAsyncTask.php” file and change this code:
private function convert_user_data($user_data_normalized){
$norm_key_to_key = [
AAMSettingsFields::EMAIL => 'email',
AAMSettingsFields::FIRST_NAME => 'first_name',
AAMSettingsFields::LAST_NAME => 'last_name',
AAMSettingsFields::GENDER => 'gender',
AAMSettingsFields::DATE_OF_BIRTH => 'date_of_birth',
AAMSettingsFields::EXTERNAL_ID => 'external_id',
AAMSettingsFields::PHONE => 'phone',
AAMSettingsFields::CITY => 'city',
AAMSettingsFields::STATE => 'state',
AAMSettingsFields::ZIP_CODE => 'zip_code',
AAMSettingsFields::COUNTRY => 'country_code',
];
$user_data = array();
foreach($user_data_normalized as $norm_key => $field){
To this code:
private function convert_user_data($user_data_normalized){
$norm_key_to_key = [
AAMSettingsFields::EMAIL => 'emails',
AAMSettingsFields::FIRST_NAME => 'first_names',
AAMSettingsFields::LAST_NAME => 'last_names',
AAMSettingsFields::GENDER => 'genders',
AAMSettingsFields::DATE_OF_BIRTH => 'dates_of_birth',
AAMSettingsFields::EXTERNAL_ID => 'external_ids',
AAMSettingsFields::PHONE => 'phones',
AAMSettingsFields::CITY => 'cities',
AAMSettingsFields::STATE => 'states',
AAMSettingsFields::ZIP_CODE => 'zip_codes',
AAMSettingsFields::COUNTRY => 'country_codes',
];
$user_data = array();
foreach($user_data_normalized as $norm_key => $field){
Or alternatively you can simply download this version where I have already done this.