// We store our setting values in a string variable.
// So we have to do the conversion here so that the compare below works.
// The exception are array values.
- $dbvalue = (!is_array($value) ? (string)$value : $value);
-
- $stored = $this->get($uid, $cat, $key, false);
+ $compare_value = (!is_array($value) ? (string)$value : $value);
+ $stored_value = $this->get($uid, $cat, $key, false);
if (!isset($this->in_db[$uid])) {
$this->in_db[$uid] = [];
$this->in_db[$uid][$cat][$key] = false;
}
- if (($stored === $dbvalue) && $this->in_db[$uid][$cat][$key]) {
+ if (isset($stored_value) && ($stored_value === $compare_value) && $this->in_db[$uid][$cat][$key]) {
return true;
}
// manage array value
- $dbvalue = (is_array($value) ? serialize($value) : $dbvalue);
+ $dbvalue = (is_array($value) ? serialize($value) : $value);
$result = DBA::update('pconfig', ['v' => $dbvalue], ['uid' => $uid, 'cat' => $cat, 'k' => $key], true);