PaulB
Well-known member
- Affected version
- 2.2.3 Patch 1
Repro:
config.php:
Output:
Changing this code in App.php:
...to this:
... resolves the issue, but I'm not entirely sure whether defaultLanguageId is actually supposed to be missing there, so the real bug may be elsewhere.
- Clean environment, such as a VM or Docker. I used Docker Compose with the following images:
- openresty/openresty:1.19.3.1-2-alpine
- php:8.0.2-fpm-alpine3.12 (with PHP extensions)
- mariadb:10.5.8-focal
- elasticsearch:7.10.1
- XenForo 2.2.3 Patch 1 (2020371)
- Create a database named
xf2
. - Create a basic config.php, attached below.
- Run:
Code:
php cmd.php xf:install \
--no-interaction \
--user='AzureDiamond' \
--password='hunter2' \
--email='test@xf2.localhost' \
--title='Test' \
--url='http://localhost' \
--skip-statistics
config.php:
PHP:
<?php
declare(strict_types=1);
$config = [
'debug' => true,
'enableMail' => false,
'enableApi' => false,
'enableOneClickUpgrade' => false,
'checkVersion' => false,
'fullUnicode' => true,
'db' => [
'host' => 'mysql',
'port' => '3306',
'username' => 'root',
'password' => '',
'dbname' => 'xf2',
],
];
Output:
Code:
All 4920 checked files are present and correct. :)
Database name: xf2
Creating tables...
212/212 [============================] 100%
Done.
Creating default data...
28/28 [============================] 100%
Done. Importing data...
Importing... Master data (Bb code media sites)
In App.php line 1254:
[E_WARNING] Undefined array key "defaultLanguageId"
Changing this code in App.php:
PHP:
$container->factory('language', function($id, array $params, Container $c)
{
$id = intval($id);
$cache = $c['language.cache'];
if (!$id || !isset($cache[$id]))
{
$id = $c['options']->defaultLanguageId;
}
PHP:
$container->factory('language', function($id, array $params, Container $c)
{
$id = intval($id);
$cache = $c['language.cache'];
if (!$id || !isset($cache[$id]))
{
$id = $c['options']->defaultLanguageId ?? 0;
}
Last edited: