insidious set_config bug

This commit is contained in:
Zach Prezkuta 2013-01-18 23:38:49 -07:00
parent 83448507b8
commit bf26af5ac6
4 changed files with 26 additions and 9 deletions

View file

@ -85,6 +85,15 @@ function get_config($family, $key, $instore = false) {
if(! function_exists('set_config')) {
function set_config($family,$key,$value) {
global $a;
// If $a->config[$family] has been previously set to '!<unset>!', then
// $a->config[$family][$key] will evaluate to $a->config[$family][0], and
// $a->config[$family][$key] = $value will be equivalent to
// $a->config[$family][0] = $value[0] (this causes infuriating bugs),
// so unset the family before assigning a value to a family's key
if($a->config[$family] === '!<unset>!')
unset($a->config[$family]);
// manage array value
$dbvalue = (is_array($value)?serialize($value):$value);
$dbvalue = (is_bool($dbvalue) ? intval($dbvalue) : $dbvalue);

View file

@ -19,7 +19,7 @@ function dbupdate_run(&$argv, &$argc) {
load_config('config');
load_config('system');
check_config($a);
update_db($a);
}
if (array_search(__file__,get_included_files())===0){