- 상태
- 해결됨
- 보고된 제품
- WPForms Multilingual 0.3.5
- 해결된 버전
- WPForms Multilingual 0.3.6
- 주제 태그
- Compatibility
문제 개요
WPForms를 사용 중이며 최근에 1.8.5.1로 업데이트한 경우, 웹사이트가 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' ];