WPML
Trạng thái
Đã giải quyết
Được báo cáo cho
Advanced Custom Fields Multilingual 2.0.5
Đã giải quyết trong
Advanced Custom Fields Multilingual 2.1.0
Plugin/giao diện liên quan
Advanced Custom Fields (ACF)
Thẻ chủ đề
Compatibility

Tổng quan về lỗi

Lỗi nghiêm trọng sau có thể xảy ra khi sử dụng plugin Advanced Custom Fields. Lỗi này đặc biệt xuất hiện với PHP 8 trở lên:


Fatal error: Uncaught TypeError: Illegal offset type in isset or empty in .../wp-content/plugins/sitepress-multilingual-cms/classes/core-abstract-classes/class-wpml-element-translation.php:259

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

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


  • Mở tệp …/wp-content/plugins/acfml/classes/class-wpml-acf-attachments.php.

  • Tìm dòng 28.

  • Thay thế:
    			foreach ( $attachments as $key => $attachment_id ) {
    					$translated_attachments[ $key ] = apply_filters( 'wpml_object_id', $attachment_id, 'attachment', true );

  • Bằng:
    			foreach ( $attachments as $key => $attachment_id ) {
    				if (is_int($attachment_id)) {
    					$translated_attachments[ $key ] = apply_filters( 'wpml_object_id', $attachment_id, 'attachment', true );
    				}

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