- 상태
- 해결됨
- 보고된 제품
- WPML Multilingual CMS 4.5.10
- 해결된 버전
- WPML 4.6.4
- 관련 플러그인/테마
- Elementor
- 주제 태그
- Bug, Compatibility
문제 개요
Elementor가 필요한 데모 콘텐츠(예: Astra 또는 Real Homes 테마에서 제공되는 콘텐츠)를 가져오면 이를 번역할 수 없으며, PHP 8에서 다음과 같은 오류가 발생합니다.
Fatal error: Uncaught TypeError: json_decode(): Argument #1 ($json) must be of type string, array given in …/wp-content/plugins/sitepress-multilingual-cms/addons/wpml-page-builders/classes/Integrations/Elementor/DataConvert.php:22
이는 데모 콘텐츠가 직렬화된 데이터이고 통합 코드는 JSON으로 인코딩된 문자열을 예상하기 때문에 발생합니다.
임시 해결 방법
진행하기 전에 반드시 사이트의 전체 백업을 생성하세요.
- …/wp-content/plugins/sitepress-multilingual-cms/addons/wpml-page-builders/classes/Integrations/Elementor/DataConvert.php 파일을 편집하세요.
- 21번 줄을 찾으세요.
- 다음을:
public static function unserialize( $data ) { return json_decode( is_array( $data ) ? $data[0] : $data, true ); }다음과 같이 변경하세요:
public static function unserialize( $data ) { $data = is_array( $data ) ? $data[0] : $data; if (is_string($data)) { return json_decode( $data, true ); } return $data; }