סקירת התקלה
השגיאה הקריטית הבאה עלולה להתרחש בעת השימוש בתוסף Advanced Custom Fields. השגיאה נצפית ספציפית ב־PHP 8 ומעלה:
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
פתרון עוקף
בעיה זו תוקנה ב־Advanced Custom Fields Multilingual 2.1.0. עדכון פותר זאת באתר שלך, לכן אתה זקוק לפתרון העוקף הזה רק אם עדיין אינך יכול לעדכן.
אנא ודא שיש לך גיבוי מלא של האתר שלך לפני שתמשיך.
- פתח את הקובץ …/wp-content/plugins/acfml/classes/class-wpml-acf-attachments.php.
- חפש את שורה 28.
- החלף את:
foreach ( $attachments as $key => $attachment_id ) { $translated_attachments[ $key ] = apply_filters( 'wpml_object_id', $attachment_id, 'attachment', true ); - ב:
foreach ( $attachments as $key => $attachment_id ) { if (is_int($attachment_id)) { $translated_attachments[ $key ] = apply_filters( 'wpml_object_id', $attachment_id, 'attachment', true ); }