WPML
สถานะ
แก้ไขแล้ว
รายงานสำหรับ
Advanced Custom Fields Multilingual 2.0.5
แก้ไขใน
Advanced Custom Fields Multilingual 2.1.0
ปลั๊กอิน/ธีมที่เกี่ยวข้อง
Advanced Custom Fields (ACF)
แท็กหัวข้อ
Bug, Compatibility

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

หากคุณใช้ปลั๊กอิน Advanced Custom Fields ร่วมกับ WPML คุณอาจพบข้อผิดพลาดร้ายแรงของ PHP ดังต่อไปนี้:


PHP Fatal error: Uncaught TypeError: md5(): Argument #1 ($string) must be of type string, array given in .../wp-content/plugins/acfml/classes/Strings/Package.php:97

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

โปรดตรวจสอบให้แน่ใจว่าคุณได้สำรองข้อมูลทั้งหมดของเว็บไซต์ก่อนดำเนินการต่อ


  • เปิดไฟล์ …/wp-content/plugins/acfml/classes/Strings/Traversable/Field.php

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

  • เปลี่ยน:
    	protected function transform( Transformer $transformer, $value, $config ) {
    		if ( is_array( $value ) ) {
    			foreach ( $value as $key => $label ) {
    				$value[ $key ] = $transformer->transform( $label, $config );
    			}
    		} else {
    			$value = $transformer->transform( $value, $config );
    		}
    
    		return $value;
    	}

  • เป็น:
    	protected function transform( Transformer $transformer, $value, $config ) {
    		if ( is_array( $value ) ) {
    			foreach ( $value as $key => $label ) {
            if ( is_string( $label ) ) {
        				$value[ $key ] = $transformer->transform( $label, $config );
            }
    			}
    		} else {
    			$value = $transformer->transform( $value, $config );
    		}
    
    		return $value;
    	}

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