aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/config.php11
-rw-r--r--include/crypto.php11
-rw-r--r--include/text.php19
-rw-r--r--version.inc2
4 files changed, 32 insertions, 11 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);
diff --git a/include/crypto.php b/include/crypto.php
index d82ee5114..d636c6848 100644
--- a/include/crypto.php
+++ b/include/crypto.php
@@ -25,16 +25,7 @@ function rsa_verify($data,$sig,$key,$alg = 'sha256') {
if(! $verify) {
while($msg = openssl_error_string())
logger('openssl_verify: ' . $msg,LOGGER_NORMAL,LOG_ERR);
- logger('openssl_verify: key: ' . $key, LOGGER_DEBUG, LOG_ERR);
- // provide a backtrace so that we can debug key issues
- if(version_compare(PHP_VERSION, '5.4.0') >= 0) {
- $stack = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
- if($stack) {
- foreach($stack as $s) {
- logger('stack: ' . basename($s['file']) . ':' . $s['line'] . ':' . $s['function'] . '()',LOGGER_DEBUG,LOG_ERR);
- }
- }
- }
+ btlogger('openssl_verify: key: ' . $key, LOGGER_DEBUG, LOG_ERR);
}
return $verify;
diff --git a/include/text.php b/include/text.php
index 621f4cf93..8e822532e 100644
--- a/include/text.php
+++ b/include/text.php
@@ -569,6 +569,25 @@ function logger($msg, $level = LOGGER_NORMAL, $priority = LOG_INFO) {
@file_put_contents($pluginfo['filename'], $pluginfo['message'], FILE_APPEND);
}
+// like logger() but with a function backtrace to pinpoint certain classes
+// of problems which show up deep in the calling stack
+
+
+function btlogger($msg, $level = LOGGER_NORMAL, $priority = LOG_INFO) {
+
+ logger($msg, $level, $priority);
+ if(version_compare(PHP_VERSION, '5.4.0') >= 0) {
+ $stack = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
+ if($stack) {
+ for($x = 1; $x < count($stack); $x ++) {
+ logger('stack: ' . basename($stack[$x]['file']) . ':' . $stack[$x]['line'] . ':' . $stack[$x]['function'] . '()',$level, $priority);
+ }
+ }
+ }
+}
+
+
+
function log_priority_str($priority) {
$parr = array(
LOG_EMERG => 'LOG_EMERG',
diff --git a/version.inc b/version.inc
index 60ac151ba..a4b2e5243 100644
--- a/version.inc
+++ b/version.inc
@@ -1 +1 @@
-2016-03-29.1350H
+2016-03-30.1351H