- Status
- Resolvido
- Relatado para
- WPML Multilingual CMS 4.7.4
- Resolvido em
- WPML 4.7.5
- Plugin/tema relacionado
- Elementor
- Tags de tópico
- Compatibility
Visão geral do problema
Após atualizar o WPML, um erro crítico pode ocorrer em algumas páginas de produtos do WooCommerce quando os plugins Elementor e Tradução de Strings estão ativos. Esse problema é causado pela integração do Elementor no WPML quando ela tenta serializar dados null, resultando em um TypeError fatal.
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 ...
Solução alternativa
Por favor, certifique-se de ter um backup completo do seu site antes de prosseguir.
- Abra o arquivo …/wp-content/plugins/sitepress-multilingual-cms/addons/wpml-page-builders/classes/Integrations/Elementor/Hooks/QueryFilter.php.
- Procure a linha 28.
- Substitua:
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; }
- Por:
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; }
Nossos desenvolvedores já estão trabalhando em uma nova versão para corrigir esse problema.