From 1a47af8c7b00139a989c8f914290f7bb4eeb3998 Mon Sep 17 00:00:00 2001 From: Denis Flaven Date: Sat, 22 Aug 2009 09:52:12 +0000 Subject: [PATCH] - Do NOT rely on PHP short open tags, for a better compatibility - In case of exception, display the whole error string even if it contains HTML tags, sometimes ugly but sometimes VERY useful SVN:code[99] --- trunk/core/config.class.inc.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/trunk/core/config.class.inc.php b/trunk/core/config.class.inc.php index c18c716ffb..ca2d4a5e9d 100644 --- a/trunk/core/config.class.inc.php +++ b/trunk/core/config.class.inc.php @@ -70,8 +70,7 @@ class Config try { ob_start(); - $sCode = str_replace('<'.'?php','<'.'?', $sConfigCode); - eval('?'.'>'.trim($sCode).'<'.'?'); + eval('?'.'>'.trim($sConfigCode)); $sNoise = trim(ob_get_contents()); ob_end_clean(); } @@ -84,7 +83,7 @@ class Config if (strlen($sNoise) > 0) { // Note: sNoise is an html output, but so far it was ok for me (e.g. showing the entire call stack) - throw new ConfigException('Syntax error in configuration file', array('file' => $sConfigFile, 'error' => $sNoise)); + throw new ConfigException('Syntax error in configuration file', array('file' => $sConfigFile, 'error' => ''.htmlentities($sNoise).'')); } if (!isset($MySettings) || !is_array($MySettings)) @@ -235,7 +234,7 @@ class Config fwrite($hFile, "\$MySettings = array(\n"); fwrite($hFile, "\t'db_host' => '{$this->m_sDBHost}',\n"); fwrite($hFile, "\t'db_user' => '{$this->m_sDBUser}',\n"); - fwrite($hFile, "\t'db_pwd' => '{$this->m_sDBPwd}',\n"); + fwrite($hFile, "\t'db_pwd' => '".addslashes($this->m_sDBPwd)."',\n"); fwrite($hFile, "\t'db_name' => '{$this->m_sDBName}',\n"); fwrite($hFile, "\t'db_subname' => '{$this->m_sDBSubname}',\n"); fwrite($hFile, ");\n");