WPML
สถานะ
แก้ไขแล้ว
รายงานสำหรับ
WPML String Translation 3.1.2
แก้ไขใน
String Translation 3.1.3

ภาพรวมของปัญหา

คุณอาจพบข้อผิดพลาดต่อไปนี้หลังจากอัปเดตเป็น WPML การแปลสตริง 3.1.2:

[17-Sep-2020 10:51:21 UTC] PHP Fatal error:  Uncaught InvalidArgumentException: item should be a Collection or an array or an object in .../wp-content/plugins/sitepress-multilingual-cms/vendor/wpml/fp/core/Obj.php:94

Stack trace:

#0 [internal function]: WPMLFPObj::WPMLFP{closure}(NULL, 'attachment_id', false)

#1 .../wp-content/plugins/sitepress-multilingual-cms/vendor/wpml/fp/core/functions.php(141): call_user_func_array(Object(Closure), Array)

#2 [internal function]: WPMLFPObj::WPMLFP{closure}(NULL, 'attachment_id', false)

#3 .../wp-content/plugins/sitepress-multilingual-cms/vendor/wpml/collect/src/Illuminate/Support/Traits/Macroable.php(56): call_user_func_array(Object(Closure), Array)

#4 .../wp-content/plugins/sitepress-multilingual-cms/vendor/wpml/fp/core/Obj.php(78): WPMLFPObj::__callStatic('propOr', Array)

#5 [internal function]: WPMLFPObj::WPMLFP{closure}('attachment_id', false)

#6 .../wp-content/plugins/sitepress-multilingual-cms/vendor/wpml/f in /home/add/public_html/wp-content/plugins/sitepress-multilingual-cms/vendor/wpml/fp/core/Obj.php on line 94

วิธีแก้ปัญหาชั่วคราว


  • สำรองข้อมูลไซต์ของคุณทั้งหมด

  • เปิดไฟล์ wpml-string-translation/inc/admin-texts/wpml-admin-texts.class.php ของคุณ

  • ค้นหาบรรทัดที่ 255

  • แทนที่:
    	private function isAdminText( $key, $name ) {
    		return null !== Wrapper::of( $this->getSubKey( $key, $name ) )
    		                       ->map( [ self::class, 'getKeysParts' ] )
    		                       ->map( invoke( 'reduce' )->with( flip( Obj::prop() ), $this->getOptionNames() ) )
    		                       ->get();
    	}


  • ด้วย:
    	private function isAdminText($key, $name) {
    		try {
    			return null !== Wrapper::of($this->getSubKey($key, $name))
    					->map([self::class, 'getKeysParts'])
    					->map(invoke('reduce')->with(flip(Obj::prop()), $this->getOptionNames()))
    					->get();
    		} catch (Exception $ex) {
    			error_log($ex->getMessage() . ' Option Key ' . $key);
    		}
    	}

ปัญหาที่ทราบแล้วทั้งหมด →