- use single quotes in config.php to avoid possible malformed strings (fixes GH-40)

This commit is contained in:
maxpozdeev 2022-10-06 00:47:31 +03:00
parent 82fcbcb6ba
commit 157c8ebd33

View file

@ -300,14 +300,14 @@ class Config
if (!preg_match("/^[a-zA-Z0-9_]+$/", $key)) {
throw new Exception("Unexpected constant name: ". $key);
}
if (preg_match('~\R~', $value)) {
if (preg_match('~\R~', $value)) { # newlines
throw new Exception("Unexpected constant value: ". $value);
}
return "define(\"$key\", \"". str_replace(
array("\\", "'", "\""),
array("\\\\", "\\'", "\\\""),
$value )
. "\");";
return "define('$key', '". str_replace(
array("\\", "'" ),
array("\\\\", "\\'"),
$value
) . "');";
}
public static function saveDbConfig()