From 0079295b166d28cd45b6971761891ffd05a8ffa8 Mon Sep 17 00:00:00 2001 From: Michael Grace <56653532+michael-grace@users.noreply.github.com> Date: Tue, 21 May 2024 20:17:28 +0100 Subject: [PATCH] fix the breaking issue in php8 and some of the warnings (#1150) --- src/Classes/MyRadio/MyRadioSession.php | 12 ++++++------ src/Classes/ServiceAPI/MyRadio_Banner.php | 2 +- .../ServiceAPI/MyRadio_UserTrainingStatus.php | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Classes/MyRadio/MyRadioSession.php b/src/Classes/MyRadio/MyRadioSession.php index 5cd29e670..0caac25f3 100644 --- a/src/Classes/MyRadio/MyRadioSession.php +++ b/src/Classes/MyRadio/MyRadioSession.php @@ -27,12 +27,12 @@ public function __construct() $this->db = Database::getInstance(); } - public function open($save_path, $sesion_name) + public function open($save_path, $sesion_name): bool { return true; } - public function close() + public function close(): bool { return true; } @@ -41,7 +41,7 @@ public function close() * Clear up old session entries in the database * This should be called automatically by PHP every one in a while. */ - public function gc($lifetime) + public function gc($lifetime): int|false { $this->db->query( 'DELETE FROM sso_session WHERE timestamp<$1', @@ -55,7 +55,7 @@ public function gc($lifetime) * Reads the session data from the database. If no data exists, creates an * empty row. */ - public function read($id) + public function read($id): string|false { if (empty($id)) { return false; @@ -87,7 +87,7 @@ public function read($id) /** * Writes changes to the session data to the database. */ - public function write($id, $data) + public function write($id, $data): bool { if (empty($id)) { return false; @@ -107,7 +107,7 @@ public function write($id, $data) /** * Deletes the session entry from the database. */ - public function destroy($id) + public function destroy($id): bool { if (empty($id)) { return false; diff --git a/src/Classes/ServiceAPI/MyRadio_Banner.php b/src/Classes/ServiceAPI/MyRadio_Banner.php index c39969179..99a0c527e 100644 --- a/src/Classes/ServiceAPI/MyRadio_Banner.php +++ b/src/Classes/ServiceAPI/MyRadio_Banner.php @@ -276,7 +276,7 @@ public function setPhoto(MyRadio_Photo $photo) * * @throws MyRadioException */ - public static function create(MyRadio_Photo $photo, $alt = 'Unnamed Banner', $target = null, $type = 2) + public static function create($photo, $alt = 'Unnamed Banner', $target = null, $type = 2) { $result = self::$db->fetchColumn( 'INSERT INTO website.banner (alt, image, target, banner_type_id, photoid) diff --git a/src/Classes/ServiceAPI/MyRadio_UserTrainingStatus.php b/src/Classes/ServiceAPI/MyRadio_UserTrainingStatus.php index ab216deec..e872de59a 100644 --- a/src/Classes/ServiceAPI/MyRadio_UserTrainingStatus.php +++ b/src/Classes/ServiceAPI/MyRadio_UserTrainingStatus.php @@ -85,7 +85,7 @@ protected function __construct($statusid) $this->user = (int) $result['memberid']; $this->awarded_time = strtotime($result['completeddate']); $this->awarded_by = (int) $result['confirmedby']; - $this->revoked_time = strtotime($result['revokedtime']); + $this->revoked_time = $result['revokedtime'] ? strtotime($result['revokedtime']) : null; $this->revoked_by = (int) $result['revokedby']; parent::__construct($result['presenterstatusid']);