Skip to content

A free, self-hostable news aggregator…

Fix safe_ascii (#5311)

Alexandre Alapetite687d0b40a89b
diff --git a/lib/lib_rss.php b/lib/lib_rss.php
index 22af2729b..d4dd1635d 100644
--- a/lib/lib_rss.php
+++ b/lib/lib_rss.php
@@ -132,8 +132,8 @@ function checkUrl(string $url, bool $fixScheme = true) {
}
}
-function safe_ascii(string $text): string {
- return filter_var($text, FILTER_DEFAULT, FILTER_FLAG_STRIP_LOW | FILTER_FLAG_STRIP_HIGH) ?: '';
+function safe_ascii(?string $text): string {
+ return $text === null ? '' : (filter_var($text, FILTER_DEFAULT, FILTER_FLAG_STRIP_LOW | FILTER_FLAG_STRIP_HIGH) ?: '');
}
if (function_exists('mb_convert_encoding')) {