PaulB
Well-known member
- Affected version
- 2.1.10 Patch 2
In
Notice the logic when neither
In theory, this could result in an exception being thrown in
XF\App#initialize
, definition for $container['config']
:
PHP:
$container['config'] = function (Container $c)
{
$default = $c['config.default'];
$file = $c['config.file'];
$legacyFile = $c['config.legacyFile'];
if (file_exists($file))
{
$config = [];
require($file);
$config = array_replace_recursive($default, $config);
$config['exists'] = true;
$config['legacyExists'] = null;
}
else
{
if (file_exists($legacyFile))
{
$config = [];
require($legacyFile);
$config = array_replace_recursive($default, $config);
$config['legacyExists'] = true;
}
else
{
// LOGIC ERROR HERE
$config['legacyExists'] = false;
$config = $default;
}
}
// ...
return $config;
};
Notice the logic when neither
$file
nor $legacyFile
exist: $config
is overwritten $default
after being set to $config = ['legacyExists' => false];
. Those two lines should be swapped.In theory, this could result in an exception being thrown in
setup
, though I haven't attempted to run the relevant code:
PHP:
function setup(array $options = [])
{
$config = $this->container('config');
if (!$config['exists'])
{
if ($config['legacyExists']) // EXCEPTION HERE
{