From 8d3a3c9a3e5e17c9088fb92a5fb35f2fc650aeb3 Mon Sep 17 00:00:00 2001 From: Tony Murray Date: Wed, 6 Feb 2019 14:24:39 -0600 Subject: [PATCH] Handle unexpected os when loading yaml (#9790) --- includes/common.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/includes/common.php b/includes/common.php index fc56d60f0f..4747f54856 100644 --- a/includes/common.php +++ b/includes/common.php @@ -1601,12 +1601,14 @@ function load_all_os($existing = false, $cached = true) } foreach ($os_list as $file) { - $tmp = Symfony\Component\Yaml\Yaml::parse(file_get_contents($file)); + if (is_readable($file)) { + $tmp = Symfony\Component\Yaml\Yaml::parse(file_get_contents($file)); - if (isset($config['os'][$tmp['os']])) { - $config['os'][$tmp['os']] = array_replace_recursive($tmp, $config['os'][$tmp['os']]); - } else { - $config['os'][$tmp['os']] = $tmp; + if (isset($config['os'][$tmp['os']])) { + $config['os'][$tmp['os']] = array_replace_recursive($tmp, $config['os'][$tmp['os']]); + } else { + $config['os'][$tmp['os']] = $tmp; + } } } }