WPML
Status
Resolved
Reported for
Advanced Custom Fields Multilingual 2.0.5
Resolved in
Advanced Custom Fields Multilingual 2.1.0
Related plugin/theme
Advanced Custom Fields (ACF)
Topic tags
Bug, Compatibility

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

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;
    	}

All known issues →