Overview of the Issue
If you’re using the Advanced Custom Fields plugin with WPML, you might encounter a PHP fatal error like the following:
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
Workaround
This issue is fixed in Advanced Custom Fields Multilingual 2.1.0. Updating solves it on your site, so you only need this workaround if you can’t update yet.
Please, make sure of having a full backup of your site before proceeding.
- Open …/wp-content/plugins/acfml/classes/Strings/Traversable/Field.php file.
- Look for line 24.
- Change:
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; } - For:
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; }
Still Seeing This Issue?
If updating doesn’t fix it, ask a support question and we’ll look into it with you.
Ask a support question