From bd1f139c2ec48e8fe470479d303c85b7d98cc8c8 Mon Sep 17 00:00:00 2001 From: Sarjuuk Date: Thu, 2 Oct 2025 16:16:49 +0200 Subject: [PATCH] CLI/Misc * handle error case where setup is run automated and receives no input on STDIN --- includes/setup/cli.class.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/includes/setup/cli.class.php b/includes/setup/cli.class.php index 14cda6cf..47a05ee6 100644 --- a/includes/setup/cli.class.php +++ b/includes/setup/cli.class.php @@ -288,7 +288,12 @@ abstract class CLI continue; // stream_get_contents is always blocking under WIN - fgets should work similary as php always receives a terminated line of text - $chars = str_split(OS_WIN ? fgets(STDIN) : stream_get_contents(STDIN)); + $chars = str_split(OS_WIN ? fgets(STDIN) : stream_get_contents(STDIN)); + + // $chars can be empty if used non-interactive + if (!$chars) + return false; + $ordinals = array_map('ord', $chars); if ($ordinals[0] == self::CHR_ESC)