Resolved
Reported for: WPForms Multilingual 0.3.5
Resolved in: WPForms Multilingual 0.3.6
Overview of the issue
If you are using WPForms and have recently updated to 1.8.5.1, you may encounter the following error in your debug.log information if your website is running under a PHP8 environment:
PHP Fatal error: Uncaught TypeError: strlen(): Argument #1 ($str) must be of type string, array given in .../wp-includes/formatting.php:3557
Workaround
Customers experiencing this issue are advised to revert to WPForms 1.8.4 until a fix is released.
Otherwise, please, make sure of having a full backup of your site before proceeding.
- Open …/wp-content/plugins/wpml-wpforms/classes/Hooks/WpForms/Notifications.php file.
- Look for line 70.
- Change:
public function applyEmailTranslations( $data, $emails ) { $package = $this->newPackage( $this->getId( $emails->form_data ) ); do_action( 'wpml_switch_language_for_email', $data['to'] ); $dataKeys = [ 'subject', 'message' ];
- For:
public function applyEmailTranslations( $data, $emails ) { $package = $this->newPackage( $this->getId( $emails->form_data ) ); if (is_array($data['to'])){ foreach ($data['to'] as $address){ do_action( 'wpml_switch_language_for_email', $address ); } } else { do_action( 'wpml_switch_language_for_email', $data['to'] ); } $dataKeys = [ 'subject', 'message' ];