From 3323ae78ce4e021b4ffc00b96770fc23bbbc8e47 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Sat, 20 Nov 2021 16:11:44 +0300 Subject: * sql_bool_to_bool: make parameter nullable * errorhandler: don't try to truncate null strings * UrlHelper::rewrite_relative: fix undefined offset warnings for URLs that lack schema/host (data: etc) --- include/functions.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'include/functions.php') diff --git a/include/functions.php b/include/functions.php index af4819f00..14de32e95 100644 --- a/include/functions.php +++ b/include/functions.php @@ -341,7 +341,12 @@ } } - function sql_bool_to_bool(string $s): bool { + /** Convert values accepted by tt-rss as true/false to PHP booleans + * @see https://tt-rss.org/wiki/ApiReference#boolean-values + * @param null|string $s null values are considered false + * @return bool + */ + function sql_bool_to_bool(?string $s): bool { return $s && ($s !== "f" && $s !== "false"); //no-op for PDO, backwards compat for legacy layer } -- cgit v1.2.3