From ba9339372a7bc0678c6c1f74336406ab1bbb4ecb Mon Sep 17 00:00:00 2001 From: Jan Tojnar Date: Fri, 14 Oct 2022 00:35:52 +0200 Subject: [PATCH] Configuration: Allow unquoted special characters in `config.ini` Quoted strings will still work but not escaping within them with a backslash. Also disables some other stuff like using `off`/`none`/`no`/`false` literals for booleans (`0` still works) or variable interpolation. https://www.php.net/manual/en/function.parse-ini-file.php Fixes: https://github.com/fossar/selfoss/issues/1371 --- NEWS.md | 6 ++++++ src/helpers/Configuration.php | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/NEWS.md b/NEWS.md index 6621ed6b15..149ef038a7 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,4 +1,10 @@ # selfoss news +## 2.20 – unreleased + +### Bug fixes +- Configuration parser was changed to *raw* method, which relaxes the requirement to quote option values containing special characters in `config.ini`. ([#1371](https://github.com/fossar/selfoss/issues/1371)) + + ## 2.19 – 2022-10-12 **This version requires PHP 5.6 or newer. It is also the last version to support PHP 7.** diff --git a/src/helpers/Configuration.php b/src/helpers/Configuration.php index b2cbd670af..b2c0329be9 100644 --- a/src/helpers/Configuration.php +++ b/src/helpers/Configuration.php @@ -171,7 +171,7 @@ class Configuration { public function __construct($configPath = null, $environment = []) { // read config.ini, if it exists if ($configPath !== null && file_exists($configPath)) { - $config = parse_ini_file($configPath); + $config = parse_ini_file($configPath, false, INI_SCANNER_RAW); if ($config === false) { throw new Exception('Error loading config.ini'); }