From e67226a446d7e92055f0a497292841412cdc5139 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Tue, 24 Mar 2009 08:34:23 +0000 Subject: [PATCH] Do not output unescaped chars to generated configuration file. --- setup/lib/ConfigFile.class.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/setup/lib/ConfigFile.class.php b/setup/lib/ConfigFile.class.php index 09efc9594..d9d5e3fd4 100644 --- a/setup/lib/ConfigFile.class.php +++ b/setup/lib/ConfigFile.class.php @@ -286,6 +286,7 @@ class ConfigFile if ($this->getServerCount() > 0) { $ret .= "/* Servers configuration */$crlf\$i = 0;" . $crlf . $crlf; foreach ($c['Servers'] as $id => $server) { + $k = preg_replace('/[^A-Za-z0-9_]/', '_', $k); $ret .= '/* Server: ' . $this->getServerName($id) . " [$id] */" . $crlf . '$i++;' . $crlf; foreach ($server as $k => $v) { @@ -301,6 +302,7 @@ class ConfigFile // other settings $persistKeys = $this->persistKeys; foreach ($c as $k => $v) { + $k = preg_replace('/[^A-Za-z0-9_]/', '_', $k); $ret .= "\$cfg['$k'] = " . var_export($v, true) . ';' . $crlf; if (isset($persistKeys[$k])) { unset($persistKeys[$k]); @@ -309,6 +311,7 @@ class ConfigFile // keep 1d array keys which are present in $persist_keys (config_info.inc.php) foreach (array_keys($persistKeys) as $k) { if (strpos($k, '/') === false) { + $k = preg_replace('/[^A-Za-z0-9_]/', '_', $k); $ret .= "\$cfg['$k'] = " . var_export($this->getDefault($k), true) . ';' . $crlf; } }