簡體   English   中英

Prestashop安裝錯誤-語言類上的array_key_exists參數

[英]Prestashop install error - array_key_exists parameter on Language class

我正在嘗試讓Prestashop與Docker和Composer一起工作。

我使用助手進行安裝。 該助手在模塊安裝部分出現錯誤。

/install-dev/index.php?installModules=true

Warning: array_key_exists() expects parameter 2 to be array, null given in /var/www/html/classes/Language.php on line 645
Call Stack
#   Time    Memory  Function    Location
1   0.0002  251136  {main}( )   .../index.php:0
2   0.0163  2377856 InstallControllerHttp::execute( )   .../index.php:31
3   0.2252  4246288 InstallControllerHttpProcess->process( )    .../controllerHttp.php:173
4   0.2253  4246656 InstallControllerHttpProcess->processInstallModules( )  .../process.php:97
5   0.2591  9068744 InstallModelInstall->installModules( )  .../process.php:226
6   0.2636  9900216 ModuleCore::getInstanceByName( )    .../install.php:729
7   0.2636  9900664 ModuleCore::coreLoadModule( )   .../Module.php:1107
8   0.2651  10219816    Adapter_ServiceLocator::get( )  .../Module.php:1142
9   0.2651  10219816    Core_Foundation_IoC_Container->make( )  .../Adapter_ServiceLocator.php:52
10  0.2651  10219952    Core_Foundation_IoC_Container->doMake( )    .../Core_Foundation_IoC_Container.php:170
11  0.2651  10220832    Core_Foundation_IoC_Container->makeInstanceFromClassName( ) .../Core_Foundation_IoC_Container.php:157
12  0.2651  10221608    newInstance ( ) .../Core_Foundation_IoC_Container.php:124
13  0.2651  10222472    ThemeConfigurator->__construct( )   .../Core_Foundation_IoC_Container.php:124
14  0.2651  10227256    LanguageCore::getLanguage( )    .../themeconfigurator.php:43
15  0.2651  10227400    array_key_exists ( )    .../Language.php:645

錯誤來自此語言部分:

public static function getLanguage($id_lang)
{
    if (!array_key_exists((int)$id_lang, self::$_LANGUAGES)) {
        return false;
    }
    return self::$_LANGUAGES[(int)($id_lang)];
}

我沒有別的,我也不明白為什么self::$_LANGUAGESnull

我正在使用來自GitHub的PrestaShop的最新1.6.1.4版本。

有人遇到類似的問題嗎? 感謝幫助!

我認為他們忘記在getLanguage()方法中添加以下代碼:

if (!self::$_LANGUAGES) {
    Language::loadLanguages();
}

此代碼存在於方法getLanguages()

public static function getLanguages($active = true, $id_shop = false, $ids_only = false)
{
    if (!self::$_LANGUAGES) {
        Language::loadLanguages();
    }

    $languages = array();
    foreach (self::$_LANGUAGES as $language) {
        if ($active && !$language['active'] || ($id_shop && !isset($language['shops'][(int)$id_shop]))) {
            continue;
        }

        $languages[] = $ids_only ? $language['id_lang'] : $language;
    }

    return $languages;
}

但是getLanguage()缺少:

public static function getLanguage($id_lang)
{
    if (!array_key_exists((int)$id_lang, self::$_LANGUAGES)) {
        return false;
    }
    return self::$_LANGUAGES[(int)($id_lang)];
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM