From 8d6d09ec1969ba92d6c15724662a9d241a8e7ba2 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim=20D=C3=BCsterhus?= Date: Thu, 7 Sep 2023 13:42:01 +0200 Subject: [PATCH] Add parameter types to various HtmlInputNodeTextParser methods This catches garbage inputs (specifically `null`) a little earlier and thus improves debugging. see https://www.woltlab.com/community/thread/301492-fehler-beim-aktualisieren-der-beitr%C3%A4ge/ --- .../html/input/node/HtmlInputNodeTextParser.class.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/wcfsetup/install/files/lib/system/html/input/node/HtmlInputNodeTextParser.class.php b/wcfsetup/install/files/lib/system/html/input/node/HtmlInputNodeTextParser.class.php index 8e00850da0..33b2d27517 100644 --- a/wcfsetup/install/files/lib/system/html/input/node/HtmlInputNodeTextParser.class.php +++ b/wcfsetup/install/files/lib/system/html/input/node/HtmlInputNodeTextParser.class.php @@ -233,7 +233,7 @@ class HtmlInputNodeTextParser * @param string $value node value * @param string[] $usernames list of already found usernames */ - protected function detectMention(\DOMText $text, $value, array &$usernames) + protected function detectMention(\DOMText $text, string $value, array &$usernames) { if (!\str_contains($value, '@')) { return; @@ -363,7 +363,7 @@ class HtmlInputNodeTextParser * @param string[] $groups list of group names by group id * @return string modified node value with replacement placeholders */ - protected function parseMention(\DOMText $text, $value, array $users, array $groups) + protected function parseMention(\DOMText $text, string $value, array $users, array $groups) { if (!\str_contains($value, '@')) { return $value; @@ -419,7 +419,7 @@ class HtmlInputNodeTextParser * @param bool $allowMedia media bbcode is allowed * @return string modified node value with replacement placeholders */ - protected function parseURL(\DOMText $text, $value, $allowURL, $allowMedia) + protected function parseURL(\DOMText $text, string $value, bool $allowURL, bool $allowMedia) { return \preg_replace_callback( FileUtil::LINK_REGEX, @@ -455,7 +455,7 @@ class HtmlInputNodeTextParser * @param string $value node value * @return string modified node value with replacement placeholders */ - protected function parseEmail(\DOMText $text, $value) + protected function parseEmail(\DOMText $text, string $value) { if (!\str_contains($value, '@')) { return $value; @@ -489,7 +489,7 @@ class HtmlInputNodeTextParser * @param string $value node value * @return string modified node value with replacement placeholders */ - protected function parseSmiley(\DOMText $text, $value) + protected function parseSmiley(\DOMText $text, string $value) { static $smileyPatterns = null; if ($smileyPatterns === null) { -- 2.20.1