Navigation überspringen

Resolved

Reported for: Advanced Custom Fields Multilingual 2.1.2

Resolved in: Advanced Custom Fields Multilingual 2.1.3

Topic Tags: ATE, Bug, Compatibility

Overview of the issue

If you are using Advanced Custom Fields plugin for registering custom post types or custom taxonomies, you may encounter a fatal error in environments using PHP 8 or warnings in PHP 7, when you have corrupted data stored for any of those objects:

PHP Fatal error:  Uncaught TypeError: array_walk(): Argument #1 ($array) must be of type array, null given in .../wp-content/plugins/acfml/classes/Strings/Helper/ContentTypeLabels.php:55

Workaround

Please, make sure of having a full site backup of your site before proceeding.

Option 1

With Advanced Custom Fields Multilingual disabled, edit the problematic ACF post type or taxonomy and set the missing values for the labels or the object slug, and save it. Then activate Advanced Custom Fields Multilingual and it is all good.

Option 2

  • Open …/wp-content/plugins/acfml/classes/Strings/Helper/ContentTypeLabels.php file.
  • Look for line 53.
  • Replace:
    array_walk( $objectArgs['labels'], function( &$value, $key ) use ( $translatedLabels ) {
    	$value = Obj::propOr( $value, $key, $translatedLabels );
    } );
    
  • With:
    $labels = Obj::propOr( [], 'labels', $objectArgs );
    array_walk( $labels, function( $value, $key ) use ( &$objectArgs, $translatedLabels ) {
    	$objectArgs['labels'][ $key ] = Obj::propOr( $value, $key, $translatedLabels );
    } );