Merge pull request #3343 from splitbrain/bug3271

work around disabled php_strip_whitespace. fixes #3271
This commit is contained in:
Andreas Gohr 2020-12-03 19:57:44 +01:00 committed by GitHub
commit bae9e2a144
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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);