From 4848eee7088e34e6c19467be3125c7f36887eb31 Mon Sep 17 00:00:00 2001 From: netkas Date: Wed, 22 Jan 2025 13:53:32 -0500 Subject: [PATCH] Fixed issue where \LogLib2\Classes\Utilities::getSafeValue(mixed $input) would return a null value when the typed output is `string` by including a branch that converts the `gettype($input)` to a string when the input is null. --- CHANGELOG.md | 9 +++++++++ src/LogLib2/Classes/Utilities.php | 3 ++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8a1fdb5..b6f0c6b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,15 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [1.0.1] - 2025-01-22 + +Minor changes to the project + +### Fixed + - Fixed issue where \LogLib2\Classes\Utilities::getSafeValue(mixed $input) would return + a null value when the typed output is `string` by including a branch that converts + the `gettype($input)` to a string when the input is null. + ## [1.0.0] - 2025-01-22 diff --git a/src/LogLib2/Classes/Utilities.php b/src/LogLib2/Classes/Utilities.php index 7195f01..884a66f 100644 --- a/src/LogLib2/Classes/Utilities.php +++ b/src/LogLib2/Classes/Utilities.php @@ -115,7 +115,8 @@ return match(strtolower(gettype($input))) { - 'boolean', 'integer', 'double', 'float', 'string', 'null' => $input, + 'boolean', 'integer', 'double', 'float', 'string' => $input, + 'null' => 'null', default => sprintf('[%s]', strtoupper(gettype($input))), }; }