From 3ce528760e66408e2338a63150948fe7ed825f94 Mon Sep 17 00:00:00 2001 From: mpeshev Date: Sun, 30 Nov 2025 13:58:21 +0200 Subject: [PATCH] json_last_error() usage for json_decode validation for compliance and avoiding warnings --- cli.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cli.php b/cli.php index 4716e131..dfb9fec3 100755 --- a/cli.php +++ b/cli.php @@ -92,7 +92,7 @@ function logError(string $message, int $exit_code = 1): void $promptInput = $positional_args[0]; if (str_starts_with($promptInput, '{') || str_starts_with($promptInput, '[')) { $decodedInput = json_decode($promptInput, true); - if ($decodedInput) { + if (json_last_error() === JSON_ERROR_NONE) { $promptInput = $decodedInput; } }