diff options
author | Andreas Gohr <andi@splitbrain.org> | 2013-01-16 13:59:41 +0100 |
---|---|---|
committer | Andreas Gohr <andi@splitbrain.org> | 2013-01-16 14:00:16 +0100 |
commit | d12150d88f5fe8d5718313ab6c14ab8c907c61ff (patch) | |
tree | 004b7c8690a599fa1bc288436d7fb4b4b129518b | |
parent | 741c52751f7b22a3167d9475b2adb1a79f5eeea6 (diff) | |
download | rpg-d12150d88f5fe8d5718313ab6c14ab8c907c61ff.tar.gz rpg-d12150d88f5fe8d5718313ab6c14ab8c907c61ff.tar.bz2 |
fixed problems with spaced arrays
-rw-r--r-- | lib/plugins/config/_test/data/config.php | 2 | ||||
-rw-r--r-- | lib/plugins/config/settings/config.class.php | 3 |
2 files changed, 3 insertions, 2 deletions
diff --git a/lib/plugins/config/_test/data/config.php b/lib/plugins/config/_test/data/config.php index 15d6359ad..83255f937 100644 --- a/lib/plugins/config/_test/data/config.php +++ b/lib/plugins/config/_test/data/config.php @@ -10,7 +10,7 @@ $conf['str3'] = "Hello World"; $conf['str4'] = "Hello 'World'"; $conf['str5'] = "Hello \"World\""; -$conf['arr1'] = array('foo','bar','baz'); +$conf['arr1'] = array('foo','bar', 'baz'); $conf['foo']['bar'] = 'x1'; $conf['foo']['baz'] = 'x2'; diff --git a/lib/plugins/config/settings/config.class.php b/lib/plugins/config/settings/config.class.php index 7f15df6fb..7ff310b20 100644 --- a/lib/plugins/config/settings/config.class.php +++ b/lib/plugins/config/settings/config.class.php @@ -166,12 +166,13 @@ if (!class_exists('configuration')) { // handle arrays - if(preg_match('/array ?\((.*)\)/', $value, $match)){ + if(preg_match('/^array ?\((.*)\)/', $value, $match)){ $arr = explode(',', $match[1]); // remove quotes from quoted strings & unescape escaped data $len = count($arr); for($j=0; $j<$len; $j++){ + $arr[$j] = trim($arr[$j]); $arr[$j] = preg_replace('/^(\'|")(.*)(?<!\\\\)\1$/s','$2',$arr[$j]); $arr[$j] = strtr($arr[$j], array('\\\\'=>'\\','\\\''=>'\'','\\"'=>'"')); } |