نظرة عامة على المشكلة
قد يحدث الخطأ الفادح التالي عند استخدام إضافة 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 ); }