WPML
الحالة
محلولة
أُبلغ عنها لـ
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

حل بديل مؤقت

باستخدام مدير ملفات الاستضافة أو باستخدام عميل FTP مثل Filezilla، اذهب إلى:

/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;
	}

جميع المشاكل المعروفة →