סקירת התקלה
בעת צפייה בהזמנות המשויכות ל־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, '' ); }