From e4c37a8c2dcb278095cdde7b41fdfb6b2fd8a85f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bruno=20Ryb=C3=A1rsky?= Date: Thu, 11 Apr 2024 15:15:41 +0200 Subject: [PATCH 1/3] Fix --- lib/endpoint.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/endpoint.php b/lib/endpoint.php index c2eb651..9df6c93 100644 --- a/lib/endpoint.php +++ b/lib/endpoint.php @@ -26,13 +26,13 @@ function getEndpoint($endpoint_name): string if (file_exists($endpoint_file)){ $output_tmp = runEndpoint($endpoint_file); $output["Endpoint"] = $endpoint_name; - switch (gettype($output)) { + switch (gettype($output_tmp)) { case 'string': $output = $output_tmp; $output['Status'] = 'Success'; break; case 'bool': - $output['Status'] = $output ? 'Success' : 'Fail'; + $output['Status'] = $output_tmp ? 'Success' : 'Fail'; break; default: $output['Status'] = 'Fail'; From 638f09243243d2fde193b1fb48ad4e8fd9690b60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bruno=20Ryb=C3=A1rsky?= Date: Thu, 11 Apr 2024 15:18:17 +0200 Subject: [PATCH 2/3] Update lib/endpoint.php --- lib/endpoint.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/endpoint.php b/lib/endpoint.php index 9df6c93..52abbd2 100644 --- a/lib/endpoint.php +++ b/lib/endpoint.php @@ -26,7 +26,8 @@ function getEndpoint($endpoint_name): string if (file_exists($endpoint_file)){ $output_tmp = runEndpoint($endpoint_file); $output["Endpoint"] = $endpoint_name; - switch (gettype($output_tmp)) { + $type = gettype($output_tmp); + switch ($type) { case 'string': $output = $output_tmp; $output['Status'] = 'Success'; @@ -37,6 +38,7 @@ function getEndpoint($endpoint_name): string default: $output['Status'] = 'Fail'; $output["Error"] = "Endpoint error"; + $output["Type"] = $type; http_response_code(500); } } From 9ac6421efcb33e31bac609eef4982f27a8d70b5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bruno=20Ryb=C3=A1rsky?= Date: Thu, 11 Apr 2024 15:27:06 +0200 Subject: [PATCH 3/3] Update lib/endpoint.php --- lib/endpoint.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/endpoint.php b/lib/endpoint.php index 52abbd2..4a94b8c 100644 --- a/lib/endpoint.php +++ b/lib/endpoint.php @@ -32,6 +32,10 @@ function getEndpoint($endpoint_name): string $output = $output_tmp; $output['Status'] = 'Success'; break; + case 'array': + $output = $output_tmp; + $output['Status'] = 'Success'; + break; case 'bool': $output['Status'] = $output_tmp ? 'Success' : 'Fail'; break;