Navigation überspringen

Resolved

Reported for: Advanced Custom Fields Multilingual 2.0.5

Resolved in: Advanced Custom Fields Multilingual 2.1.0

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

8 Antworten zu “Advanced Custom Fields - Uncaught TypeError: md5(): Argument #1 ($string) must be of type string, array given in...”

  1. I am also running into this issue. The only solution is to modify the plugins source code. For me the issue is that an ACF field has „choices“. The code for this plugin expects the value to be an array of key and value pairs, with both being strings. The issue arises when a value is an array. For us the issue happens because we have an ACF field whose ‚choices‘ is what is returned by the function acf_get_taxonomy_terms.

    Thanks

    • Thank you for sharing your case and I’m glad to know that the workaround here displayed was helpful.
      We will keep this erratum updated and let you know once this issue was solved.
      Regards

  2. I am also having this issue and it is now February. Please can the devs urgently provide a fix to the plugin as I don’t want to crash my company site again in the future

  3. Fatal error: Uncaught Error: ACFML\Strings\Traversable\Entity::__construct(): Argument #1 ($data) must be of type array, null given, called in /code/wp-content/plugins/acfml/classes/Strings/Factory.php on line 29
    in /code/wp-content/plugins/acfml/classes/Strings/Traversable/Entity.php on line 16