- 상태
- 해결됨
- 보고된 제품
- WPML String Translation 3.3.1
- 해결된 버전
- WPML String Translation 3.3.2
문제 개요
다음과 같은 오류가 발생할 수 있습니다:
PHP Fatal error: Uncaught TypeError: WPMLStringTranslationInfrastructureStringGettextRepositoryFrontendQueueJsonRepository::get(): Return value must be of type array, null returned in wp-contentpluginswpml-string-translationStringTranslationInfrastructureStringGettextRepositoryFrontendQueueJsonRepository.php:36
Stack trace:
#0 wp-contentpluginswpml-string-translationStringTranslationInfrastructureStringGettextRepositoryFrontendQueueRepository.php(75): WPMLStringTranslationInfrastructureStringGettextRepositoryFrontendQueueJsonRepository->get()
#1 wp-contentpluginswpml-string-translationStringTranslationInfrastructureStringHtmlCommandProcessFrontendGettextStringsQueue.php(34): WPMLStringTranslationInfrastructureStringGettextRepositoryFrontendQueueRepository->get()
.
.
.
#12 {main}
thrown in wp-contentpluginswpml-string-translationStringTranslationInfrastructureStringGettextRepositoryFrontendQueueJsonRepository.php on line 36
임시 해결 방법
호스팅의 파일 관리자나 Filezilla 같은 FTP 클라이언트를 사용하여 다음으로 이동하세요:
/wp-content/plugins/wpml-string-translation/StringTranslation/Infrastructure/StringGettext/Repository/FrontendQueueJsonRepository.php
다음 코드를 찾으세요(28번 줄 근처):
public function get(): array {
$filepath = $this->getQueueFilepath();
$data = [];
if ( file_exists( $filepath ) && is_readable( $filepath ) ) {
$data = json_decode( file_get_contents( $filepath ), true );
}
return $data;
}
그리고 다음 코드로 변경하세요:
public function get(): array {
$filepath = $this->getQueueFilepath();
$data = [];
if ( file_exists( $filepath ) && is_readable( $filepath ) ) {
$data = json_decode( file_get_contents( $filepath ), true );
}
if( is_null($data)){
$data = [];
}
return $data;
}