From f350b9bdee9fb29e6e914a915a970b5afc2e9511 Mon Sep 17 00:00:00 2001 From: Bradley Taylor Date: Sat, 19 Mar 2022 13:59:07 +0000 Subject: [PATCH] Remove use of FILTER_SANITIZE_STRING, which is deprecated in PHP 8.1.0. This follows the fix in \League\Csv\AbstractCsv::sendHeaders, from which this method is copied. --- ext/search_kit/Civi/Api4/Action/SearchDisplay/Download.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ext/search_kit/Civi/Api4/Action/SearchDisplay/Download.php b/ext/search_kit/Civi/Api4/Action/SearchDisplay/Download.php index c2cf45f192..2400ad46c8 100644 --- a/ext/search_kit/Civi/Api4/Action/SearchDisplay/Download.php +++ b/ext/search_kit/Civi/Api4/Action/SearchDisplay/Download.php @@ -193,7 +193,9 @@ class Download extends AbstractRunAction { $flag |= FILTER_FLAG_STRIP_HIGH; } - $filenameFallback = str_replace('%', '', filter_var($fileName, FILTER_SANITIZE_STRING, $flag)); + /** @var string $filtered_name */ + $filtered_name = filter_var($fileName, FILTER_UNSAFE_RAW, $flag); + $filenameFallback = str_replace('%', '', $filtered_name); $disposition = sprintf('attachment; filename="%s"', str_replace('"', '\\"', $filenameFallback)); if ($fileName !== $filenameFallback) { -- 2.25.1