- Status
- Resolved
- Reported for
- Advanced Custom Fields Multilingual 2.0.5
- Resolved in
- Advanced Custom Fields Multilingual 2.1.0
- Related plugin/theme
- Advanced Custom Fields (ACF)
- Topic tags
- Compatibility
Overview of the issue
The following fatal error may occur when using Advanced Custom Fields plugin. The error is specifically observed with PHP 8 or higher:
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
Workaround
Please, make sure of having a full backup of your site before proceeding.
- Open …/wp-content/plugins/acfml/classes/class-wpml-acf-attachments.php file.
- Look for line 28.
- Replace:
foreach ( $attachments as $key => $attachment_id ) { $translated_attachments[ $key ] = apply_filters( 'wpml_object_id', $attachment_id, 'attachment', true ); - With:
foreach ( $attachments as $key => $attachment_id ) { if (is_int($attachment_id)) { $translated_attachments[ $key ] = apply_filters( 'wpml_object_id', $attachment_id, 'attachment', true ); }