From a7ec1805e3f5836641503d1f8cb6ccc1d8c885fa Mon Sep 17 00:00:00 2001 From: Mario Date: Sun, 13 Feb 2022 18:58:12 +0000 Subject: address deprecation warnings --- include/bbcode.php | 4 ++-- include/language.php | 5 +++++ include/text.php | 7 +++++-- 3 files changed, 12 insertions(+), 4 deletions(-) (limited to 'include') diff --git a/include/bbcode.php b/include/bbcode.php index 03115effe..794cb25d0 100644 --- a/include/bbcode.php +++ b/include/bbcode.php @@ -488,9 +488,9 @@ function getAttachmentData($body) { $data["preview"] = html_entity_decode($preview, ENT_QUOTES, 'UTF-8'); } - $data["description"] = trim($match[3]); + $data["description"] = ((isset($match[3])) ? trim($match[3]) : ''); - $data["after"] = trim($match[4]); + $data["after"] = ((isset($match[4])) ? trim($match[4]) : ''); return $data; } diff --git a/include/language.php b/include/language.php index d291deb63..23aff0a02 100644 --- a/include/language.php +++ b/include/language.php @@ -311,6 +311,11 @@ function string_plural_select_default($n) { * @return string Language code in 2-letter ISO 639-1 (en, de, fr) format */ function detect_language($s) { + + if (!$s) { + return EMPTY_STR; + } + $min_length = get_config('system', 'language_detect_min_length'); if ($min_length === false) $min_length = LANGUAGE_DETECT_MIN_LENGTH; diff --git a/include/text.php b/include/text.php index 29a2ab3b1..f69801302 100644 --- a/include/text.php +++ b/include/text.php @@ -108,7 +108,10 @@ function notags($string) { * @return string */ function escape_tags($string) { - return(htmlspecialchars($string, ENT_COMPAT, 'UTF-8', false)); + if (!$string) { + return EMPTY_STR; + } + return (htmlspecialchars($string, ENT_COMPAT, 'UTF-8', false)); } @@ -3531,7 +3534,7 @@ function text_highlight($s, $lang) { // echo (($xml->asXML('data.xml')) ? 'Your XML file has been generated successfully!' : 'Error generating XML file!'); function arrtoxml($root_elem,$arr) { - $xml = new SimpleXMLElement('<' . $root_elem . '>', null, false); + $xml = new SimpleXMLElement('<' . $root_elem . '>', 0, false); array2XML($xml,$arr); return $xml->asXML(); -- cgit v1.2.3