- สถานะ
- แก้ไขแล้ว
- รายงานสำหรับ
- WPForms Multilingual 0.3.5
- แก้ไขใน
- WPForms Multilingual 0.3.6
- แท็กหัวข้อ
- Compatibility
ภาพรวมของปัญหา
หากคุณกำลังใช้งาน WPForms และเพิ่งอัปเดตเป็น 1.8.5.1 คุณอาจพบข้อผิดพลาดต่อไปนี้ในข้อมูล debug.log ของคุณ หากเว็บไซต์ของคุณทำงานในสภาพแวดล้อม PHP8:
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' ];