From 9f004f696ed51a64836be9c745ce9646e94b9d09 Mon Sep 17 00:00:00 2001 From: FusionPBX Date: Mon, 14 Aug 2023 21:35:31 -0600 Subject: [PATCH] Use trim on the file contents and use file_exists --- resources/require.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/require.php b/resources/require.php index 6b47451a61..8f94e39c95 100644 --- a/resources/require.php +++ b/resources/require.php @@ -33,9 +33,9 @@ } elseif (file_exists(__DIR__ . '/config.php')) { //set a custom config_file variable after the config.php has been validated - $file_content = file_get_contents(__DIR__ . '/config.php'); + $file_content = trim(file_get_contents(__DIR__ . '/config.php')); $pattern = '/^<\?php\s+\$config_file\s+=\s+[\'"](.+?)[\'"];\s+\?>$/'; - if (preg_match($pattern, $file_content, $matches)) { + if (preg_match($pattern, $file_content, $matches) && file_exists($matches[1])) { $config_file = $matches[1]; } }