From 0e332eb44c163ec8aa061628b8cf7e3544e52a32 Mon Sep 17 00:00:00 2001 From: Claudiu Cristea Date: Wed, 7 Sep 2022 17:13:16 +0300 Subject: [PATCH] Ensure all $args to csvToArray() are strings (#5223) --- src/Utils/StringUtils.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Utils/StringUtils.php b/src/Utils/StringUtils.php index 13079b8d81..725817c5c1 100644 --- a/src/Utils/StringUtils.php +++ b/src/Utils/StringUtils.php @@ -22,7 +22,8 @@ public static function csvToArray($args): array // Step 4: array_map(...) trims extra whitespace from each item // (handles csv strings with extra whitespace, e.g. 'a, b, c') // - return array_map('trim', array_filter(explode(',', is_array($args) ? implode(',', $args) : $args))); + $args = is_array($args) ? implode(',', array_map('strval', $args)) : (string) $args; + return array_map('trim', array_filter(explode(',', $args))); } /**