WPML
Stato
Risolto
Segnalato per
Advanced Custom Fields Multilingual 2.0.5
Risolto in
Advanced Custom Fields Multilingual 2.1.0
Plugin/tema correlato
Advanced Custom Fields (ACF)
Tag dell’argomento
Bug, Compatibility

Panoramica del problema

Se stai usando il plugin Advanced Custom Fields con WPML, potresti riscontrare un errore fatale PHP come il seguente:


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

Soluzione alternativa

Assicurati di avere un backup completo del tuo sito prima di procedere.


  • Apri il file …/wp-content/plugins/acfml/classes/Strings/Traversable/Field.php.

  • Cerca la riga 24.

  • Cambia:
    	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;
    	}

  • Con:
    	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;
    	}

Tutti i problemi noti →