From: Tim Düsterhus Date: Thu, 7 Sep 2023 11:42:01 +0000 (+0200) Subject: Add parameter types to various HtmlInputNodeTextParser methods X-Git-Tag: 6.0.0_RC_1~53^2~5 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=8d6d09ec1969ba92d6c15724662a9d241a8e7ba2;p=GitHub%2FWoltLab%2FWCF.git 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/ --- 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) {