- ステータス
- 解決済み
- 報告対象
- WPML Multilingual CMS 4.7.4
- 解決されたバージョン
- WPML 4.7.5
- 関連するプラグイン/テーマ
- Elementor
- トピックタグ
- Compatibility
問題の概要
WPMLを更新した後、Elementorおよび文字列翻訳プラグインが有効な場合、一部のWooCommerce商品ページで重大なエラーが発生することがあります。この問題は、WPMLのElementor統合機能が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; }
弊社の開発チームは、この問題を修正するための新しいリリースに向けてすでに取り組んでいます。