From: Tim Düsterhus Date: Thu, 25 Jun 2015 21:51:02 +0000 (+0200) Subject: Remove unnecessary explicit calls to __toString() X-Git-Tag: 3.0.0_Beta_1~2244^2~2 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=600628af3dea3c5fd581a1552d590a8e7cff6e7a;p=GitHub%2FWoltLab%2FWCF.git Remove unnecessary explicit calls to __toString() These are a left over from PHP 5.0 / 5.1 times when __toString() only was called within echo or print. --- diff --git a/wcfsetup/install/files/lib/data/tag/Tag.class.php b/wcfsetup/install/files/lib/data/tag/Tag.class.php index a1094c5ec2..d2b5d2a9b2 100644 --- a/wcfsetup/install/files/lib/data/tag/Tag.class.php +++ b/wcfsetup/install/files/lib/data/tag/Tag.class.php @@ -65,13 +65,8 @@ class Tag extends DatabaseObject implements IRouteController { * @return string */ public static function buildString(array $tags, $separator = ', ') { - $string = ''; - foreach ($tags as $tag) { - if (!empty($string)) $string .= $separator; - $string .= (is_object($tag) ? $tag->__toString() : $tag); - } - - return $string; + // TODO: This method seems to be unused and unnecessary, as it is a simply wrapper around implode now + return implode($separator, $tags); } /** diff --git a/wcfsetup/install/files/lib/util/StringUtil.class.php b/wcfsetup/install/files/lib/util/StringUtil.class.php index 9f5b7eae93..9a2bbea601 100644 --- a/wcfsetup/install/files/lib/util/StringUtil.class.php +++ b/wcfsetup/install/files/lib/util/StringUtil.class.php @@ -92,9 +92,6 @@ final class StringUtil { * @return string */ public static function encodeHTML($string) { - if (is_object($string)) - $string = $string->__toString(); - return @htmlspecialchars($string, ENT_COMPAT, 'UTF-8'); } @@ -105,8 +102,6 @@ final class StringUtil { * @return string */ public static function encodeJS($string) { - if (is_object($string)) $string = $string->__toString(); - // unify newlines $string = self::unifyNewlines($string);