From 8acada91b96cf3f2189f1c69c8f6b12f851f0cab Mon Sep 17 00:00:00 2001 From: gerardnico Date: Mon, 17 Jan 2022 09:45:44 +0100 Subject: [PATCH] Release 1.23 - log2file bug - error 500 --- ComboStrap/HttpResponse.php | 5 +++-- ComboStrap/LogUtility.php | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/ComboStrap/HttpResponse.php b/ComboStrap/HttpResponse.php index 3fc7b1a5d..ce090f502 100644 --- a/ComboStrap/HttpResponse.php +++ b/ComboStrap/HttpResponse.php @@ -97,8 +97,9 @@ public function send($payload = null, $contentType = null) * Exit */ if (!PluginUtility::isTest()) { - if (Http::getStatus() !== self::STATUS_ALL_GOOD) { - LogUtility::log2file($this->msg, LogUtility::LVL_MSG_ERROR, $this->canonical); + if ($this->status !== self::STATUS_ALL_GOOD && $this->msg !== null) { + // if this is a 304, there is no body, no message + LogUtility::log2file("Bad Http Response: $this->status : $this->msg", LogUtility::LVL_MSG_ERROR, $this->canonical); } exit; } else { diff --git a/ComboStrap/LogUtility.php b/ComboStrap/LogUtility.php index 27bb9fc19..fe8285d35 100644 --- a/ComboStrap/LogUtility.php +++ b/ComboStrap/LogUtility.php @@ -266,7 +266,7 @@ private static function messageNotEmpty(?string $message) $newMessage = "The passed message to the log was empty or null. BackTrace: \n"; ob_start(); $limit = 10; - debug_print_backtrace(0, $limit); + debug_print_backtrace(0, $limit); // It prints also the data passed :) $trace = ob_get_contents(); ob_end_clean(); $newMessage .= $trace;