WPML

نظرة عامة على المشكلة

عند عرض الطلبات المرتبطة بـ WooCommerce Subscriptions أثناء تفعيل WPML، قد يواجه المستخدمون خطأ فادحاً في PHP:

PHP 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

حل بديل مؤقت

تم إصلاح هذه المشكلة في Woocommerce Subscriptions 8.2.0. يحل التحديث المشكلة على موقعك، لذا لا تحتاج إلى هذا الحل البديل المؤقت إلا إذا لم تتمكن من التحديث بعد.

يُرجى التأكد من أخذ نسخة احتياطية كاملة لموقعك قبل المتابعة.

  • افتح ملف …/wp-content/plugins/woocommerce-subscriptions/vendor/woocommerce/subscriptions-core/includes/wcs-helper-functions.php.
  • غيّر من:
    function wcs_get_edit_post_link( $post_id ) {
    	$object = wc_get_order( $post_id ); // works for both WC Order and WC Subscription objects.
    
    	if ( ! $object || ! in_array( $object->get_type(), array( 'shop_order', 'shop_subscription' ), true ) ) {
    		return;
    	}
    
    	return apply_filters( 'get_edit_post_link', $object->get_edit_order_url(), $post_id, '' );
    }
  • إلى:
    function wcs_get_edit_post_link( $post_id ) {
    	if ($post_id instanceof('WC_Subscription')){
    		$post_id = $post_id->id;
    		}
    	$object = wc_get_order( $post_id ); // works for both WC Order and WC Subscription objects.
    
    	if ( ! $object || ! in_array( $object->get_type(), array( 'shop_order', 'shop_subscription' ), true ) ) {
    		return;
    	}
    
    	return apply_filters( 'get_edit_post_link', $object->get_edit_order_url(), $post_id, '' );
    }

جميع المشكلات المعروفة

هل ما زلت تواجه هذه المشكلة؟

إذا لم يحل التحديث المشكلة، فاطرح استفسار الدعم وسنبحث في الأمر معك.