- Status
- Resolvido
- Relatado para
- Advanced Custom Fields Multilingual 2.0.5
- Resolvido em
- Advanced Custom Fields Multilingual 2.1.0
- Plugin/tema relacionado
- Advanced Custom Fields (ACF)
- Tags de tópico
- Bug, Compatibility
Visão geral do problema
Se você estiver usando o plugin Advanced Custom Fields com o WPML, poderá encontrar um erro fatal do PHP como o seguinte:
PHP Fatal error: Uncaught TypeError: md5(): Argument #1 ($string) must be of type string, array given in .../wp-content/plugins/acfml/classes/Strings/Package.php:97
Solução alternativa
Por favor, certifique-se de ter um backup completo do seu site antes de prosseguir.
- Abra o arquivo …/wp-content/plugins/acfml/classes/Strings/Traversable/Field.php.
- Procure a linha 24.
- Altere:
protected function transform( Transformer $transformer, $value, $config ) { if ( is_array( $value ) ) { foreach ( $value as $key => $label ) { $value[ $key ] = $transformer->transform( $label, $config ); } } else { $value = $transformer->transform( $value, $config ); } return $value; } - Para:
protected function transform( Transformer $transformer, $value, $config ) { if ( is_array( $value ) ) { foreach ( $value as $key => $label ) { if ( is_string( $label ) ) { $value[ $key ] = $transformer->transform( $label, $config ); } } } else { $value = $transformer->transform( $value, $config ); } return $value; }