From 17a01f3775869597f0d04fe031e52c03d169d93d Mon Sep 17 00:00:00 2001 From: Jared Hendrickson Date: Wed, 17 Jan 2024 18:22:38 -0700 Subject: [PATCH] fix: ensure APISystemAPIVersionRead::get_github_releases() always returns an array in #438 --- .../files/etc/inc/api/models/APISystemAPIVersionRead.inc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pfSense-pkg-API/files/etc/inc/api/models/APISystemAPIVersionRead.inc b/pfSense-pkg-API/files/etc/inc/api/models/APISystemAPIVersionRead.inc index 2d89dc3ad..858e5fbde 100644 --- a/pfSense-pkg-API/files/etc/inc/api/models/APISystemAPIVersionRead.inc +++ b/pfSense-pkg-API/files/etc/inc/api/models/APISystemAPIVersionRead.inc @@ -83,7 +83,9 @@ class APISystemAPIVersionRead extends APIModel { $releases = ["last_updated" => time(), "releases" => $api_resp]; file_put_contents($releases_file, json_encode($releases)); } - return $releases; + + # Ensure releases is always an array + return (is_array($releases)) ? $releases : []; } public static function get_all_available_versions() {