aboutsummaryrefslogtreecommitdiffstats
path: root/include/config.php
diff options
context:
space:
mode:
Diffstat (limited to 'include/config.php')
-rw-r--r--include/config.php11
1 files changed, 11 insertions, 0 deletions
diff --git a/include/config.php b/include/config.php
index 51d4e99ac..28a72f7ea 100644
--- a/include/config.php
+++ b/include/config.php
@@ -287,6 +287,17 @@ function get_pconfig($uid, $family, $key, $instore = false) {
function set_pconfig($uid, $family, $key, $value) {
global $a;
+ // this catches subtle errors where this function has been called
+ // with local_channel() when not logged in (which returns false)
+ // and throws an error in array_key_exists below.
+ // we provide a function backtrace in the logs so that we can find
+ // and fix the calling function.
+
+ if($uid === false) {
+ btlogger('UID is FALSE!', LOGGER_NORMAL, LOG_ERR);
+ return;
+ }
+
// manage array value
$dbvalue = ((is_array($value)) ? serialize($value) : $value);
$dbvalue = ((is_bool($dbvalue)) ? intval($dbvalue) : $dbvalue);