- Trạng thái
- Đã giải quyết
- Được báo cáo cho
- WPML Multilingual CMS 4.7.4
- Đã giải quyết trong
- WPML 4.7.5
- Plugin/giao diện liên quan
- Elementor
- Thẻ chủ đề
- Compatibility
Tổng quan về lỗi
Sau khi cập nhật WPML, một lỗi nghiêm trọng có thể xảy ra trên một số trang sản phẩm WooCommerce khi các plugin Elementor và Dịch chuỗi đang hoạt động. Sự cố này do phần tích hợp Elementor trong WPML gây ra khi cố gắng tuần tự hóa dữ liệu null, dẫn đến một TypeError nghiêm trọng.
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 ...
Giải pháp tạm thời
Vui lòng đảm bảo tạo bản sao lưu toàn bộ trang web của bạn trước khi tiến hành.
- Mở tệp …/wp-content/plugins/sitepress-multilingual-cms/addons/wpml-page-builders/classes/Integrations/Elementor/Hooks/QueryFilter.php.
- Tìm dòng 28.
- Thay thế:
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; }
- Bằng:
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; }
Các nhà phát triển của chúng tôi đang chuẩn bị một phiên bản phát hành mới để khắc phục sự cố này.