From 600628af3dea3c5fd581a1552d590a8e7cff6e7a Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim=20D=C3=BCsterhus?= Date: Thu, 25 Jun 2015 23:51:02 +0200 Subject: [PATCH] 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. --- wcfsetup/install/files/lib/data/tag/Tag.class.php | 9 ++------- wcfsetup/install/files/lib/util/StringUtil.class.php | 5 ----- 2 files changed, 2 insertions(+), 12 deletions(-) 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); -- 2.20.1