Skip to content

Commit

Permalink
Configuration: Allow unquoted special characters in config.ini
Browse files Browse the repository at this point in the history
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: #1371
  • Loading branch information
jtojnar committed Oct 13, 2022
1 parent 380dd9c commit ba93393
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -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.**

Expand Down
2 changes: 1 addition & 1 deletion src/helpers/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}
Expand Down

0 comments on commit ba93393

Please sign in to comment.