- สถานะ
- แก้ไขแล้ว
- รายงานสำหรับ
- WPML Multilingual CMS 4.7.4
- แก้ไขใน
- WPML 4.7.5
- ปลั๊กอิน/ธีมที่เกี่ยวข้อง
- Elementor
- แท็กหัวข้อ
- Compatibility
ภาพรวมของปัญหา
หลังจากอัปเดต WPML อาจเกิดข้อผิดพลาดร้ายแรงบนหน้าผลิตภัณฑ์ WooCommerce บางหน้าเมื่อเปิดใช้งานปลั๊กอิน Elementor และ การแปลสตริง ปัญหานี้เกิดจากการทำงานร่วมกับ Elementor ใน WPML เมื่อพยายาม serialize ข้อมูล null ซึ่งส่งผลให้เกิด TypeError ร้ายแรง
PHP Fatal error: Uncaught TypeError: WPML\PB\Elementor\DataConvert::serialize(): Argument #1 ($data) must be of type array,
null given, called in /wp-content/plugins/sitepress-multilingual-cms/addons/wpml-page-builders/classes/Integrations/Elementor/Hooks/QueryFilter.php on line 34 ...
วิธีแก้ปัญหาชั่วคราว
โปรดตรวจสอบให้แน่ใจว่าได้สำรองข้อมูลเว็บไซต์ทั้งหมดก่อนดำเนินการต่อ
- เปิดไฟล์ …/wp-content/plugins/sitepress-multilingual-cms/addons/wpml-page-builders/classes/Integrations/Elementor/Hooks/QueryFilter.php
- ค้นหาบรรทัดที่ 28
- แทนที่:
public function translateQueryIds( $value, $object_id, $meta_key, $single ) { if ( WPML_Elementor_Data_Settings::META_KEY_DATA === $meta_key && $single ) { $value = get_post_meta( $object_id, WPML_Elementor_Data_Settings::META_KEY_DATA, true ); if ( $value ) { $value = DataConvert::unserialize( $value, false ); $value = $this->recursivelyTranslateQueryIds( $value ); $value = DataConvert::serialize( $value, false ); } } return $value; }
- ด้วย:
public function translateQueryIds( $value, $object_id, $meta_key, $single ) { if ( WPML_Elementor_Data_Settings::META_KEY_DATA === $meta_key && $single ) { $newValue = get_post_meta( $object_id, WPML_Elementor_Data_Settings::META_KEY_DATA, true ); if ( $newValue ) { $newValue = DataConvert::unserialize( $newValue, false ); if ( is_array( $newValue ) ) { $newValue = $this->recursivelyTranslateQueryIds( $newValue ); return DataConvert::serialize( $newValue, false ); } return $value; } } return $value; }
นักพัฒนาของเรากำลังพัฒนาเวอร์ชันที่เผยแพร่ใหม่เพื่อแก้ไขปัญหานี้