);
if(count($ret)) {
// manage array value
- $val = (preg_match("|^a:[0-9]+:{.*}$|", $ret[0]['v'])?unserialize( $ret[0]['v']):$ret[0]['v']);
+ $val = (preg_match("|^a:[0-9]+:{.*}$|s", $ret[0]['v'])?unserialize( $ret[0]['v']):$ret[0]['v']);
$a->config[$family][$key] = $val;
return $val;
}
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);
);
if(count($ret)) {
- $val = (preg_match("|^a:[0-9]+:{.*}$|", $ret[0]['v'])?unserialize( $ret[0]['v']):$ret[0]['v']);
+ $val = (preg_match("|^a:[0-9]+:{.*}$|s", $ret[0]['v'])?unserialize( $ret[0]['v']):$ret[0]['v']);
$a->config[$uid][$family][$key] = $val;
return $val;
}