From 8eac5140bb46377a0786e7d435db4e014479f499 Mon Sep 17 00:00:00 2001 From: Jon Ziebell Date: Sat, 24 Dec 2022 11:32:13 -0500 Subject: [PATCH] PHP 7.4 and more verbose logging for external authorizations --- api/cora/session.php | 6 +++++- api/external_api.php | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/api/cora/session.php b/api/cora/session.php index c30018e..c061940 100644 --- a/api/cora/session.php +++ b/api/cora/session.php @@ -232,7 +232,11 @@ final class session { * @return int The current user_id. */ public function get_user_id() { - return $this->session['user_id']; + if ($this->session !== null) { + return $this->session['user_id']; + } + + return null; } /** diff --git a/api/external_api.php b/api/external_api.php index 1fb6a38..8c51b92 100644 --- a/api/external_api.php +++ b/api/external_api.php @@ -47,7 +47,7 @@ class external_api extends cora\api { */ protected function curl($arguments) { $user = $this->api('user', 'get', $this->session->get_user_id()); - if ($user['debug'] === true) { + if ($user === null || $user['debug'] === true) { $this::$log_mysql = 'all'; $this::$log_mysql_verbose = true; }