- ステータス
- 解決済み
- 報告対象
- WPForms Multilingual 0.3.5
- 解決されたバージョン
- WPForms Multilingual 0.3.6
- トピックタグ
- Compatibility
問題の概要
WPFormsを使用しており、最近1.8.5.1にアップデートした場合、WebサイトがPHP8環境で稼働していると、debug.log情報に以下のエラーが発生する場合があります:
PHP Fatal error: Uncaught TypeError: strlen(): Argument #1 ($str) must be of type string, array given in .../wp-includes/formatting.php:3557
回避策
この問題が発生している場合は、修正がリリースされるまでWPForms 1.8.4に戻すことをお勧めします。
バージョンを戻さない場合は、続行する前にサイトの完全なバックアップを必ず作成してください。
- …/wp-content/plugins/wpml-wpforms/classes/Hooks/WpForms/Notifications.phpファイルを開きます。
- 70行目を探します。
- 変更前:
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' ]; - 変更後:
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' ];