From 6a6dbec0335c43137e4dc5e84b5b188edc57ba10 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Wed, 30 Mar 2016 16:33:23 -0700 Subject: issue #319 - NOTE: this does not fix the issue, it only reports it and continues. We need to examine any logger statements that contain 'stack:' as a result of reporting this issue and find and fix the original problem - which is that set_pconfig is being called without a valid $uid. I'm worried that since we will now continue on without throwing a PHP error that nobody will ever notice or find the problem that is causing this. --- include/config.php | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'include/config.php') 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); -- cgit v1.2.3