work around disabled php_strip_whitespace. fixes #3271

This commit is contained in:
Andreas Gohr 2020-11-19 20:51:22 +01:00
parent 8b07fee4b3
commit 571a8adbb8
1 changed files with 8 additions and 0 deletions

View File

@ -29,6 +29,14 @@ class ConfigParser {
$config = array();
$contents = @php_strip_whitespace($file);
// fallback to simply including the file #3271
if($contents === null) {
$conf = [];
include $file;
return $conf;
}
$pattern = '/\$' . $this->varname . '\[[\'"]([^=]+)[\'"]\] ?= ?(.*?);(?=[^;]*(?:\$' . $this->varname . '|$))/s';
$matches = array();
preg_match_all($pattern, $contents, $matches, PREG_SET_ORDER);