WPML

Tổng quan về sự cố

Bạn có thể gặp phải lỗi nghiêm trọng sau khi cập nhật plugin Advanced Custom Fields Multilingual lên phiên bản 2.1.4.1 khi đồng thời sử dụng các plugin Advanced Custom Fields: Extended và Advanced Custom Fields Pro:

Fatal error: Uncaught InvalidArgumentException: item should be a Collection or an array or an object in .../wp-content/plugins/sitepress-multilingual-cms/vendor/wpml/fp/core/Obj.php:112

Giải pháp tạm thời

Vui lòng đảm bảo bạn đã tạo bản sao lưu toàn bộ trang web trước khi tiếp tục.

  • Mở tệp …/wp-content/plugins/acfml/classes/class-wpml-acf-options-page.php.
  • Tìm dòng 280.
  • Thay thế:
    private static function isValidOptionPagePostId( $postId ) {
    	return function_exists( 'acf_get_options_pages' )
    	       && wpml_collect( acf_get_options_pages() )->first( Relation::propEq( 'post_id', $postId ) );
    }
  • Bằng:
    private static function isValidOptionPagePostId( $postId ) {
    	if ( function_exists( 'acf_get_options_pages' ) ) {
    		$optionPages = acf_get_options_pages();
    
    		if ( $optionPages ) {
    			return wpml_collect( acf_get_options_pages() )->first( Relation::propEq( 'post_id', $postId ) );
    		}		
    	}
    
    	return false;
    }

Tất cả lỗi đã ghi nhận