From 2a1449aa802d6c64069156321f07baf9f0f50c62 Mon Sep 17 00:00:00 2001 From: Matthias Schmidt Date: Sun, 7 Aug 2016 13:45:57 +0200 Subject: [PATCH] Use PreparedStatement::fetchObject() in Tag::getTag() --- wcfsetup/install/files/lib/data/tag/Tag.class.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/wcfsetup/install/files/lib/data/tag/Tag.class.php b/wcfsetup/install/files/lib/data/tag/Tag.class.php index 9cc4ad169f..f580b9b0bc 100644 --- a/wcfsetup/install/files/lib/data/tag/Tag.class.php +++ b/wcfsetup/install/files/lib/data/tag/Tag.class.php @@ -24,7 +24,7 @@ class Tag extends DatabaseObject implements IRouteController { * * @param string $name * @param integer $languageID - * @return mixed + * @return Tag|null */ public static function getTag($name, $languageID = 0) { $sql = "SELECT * @@ -33,10 +33,8 @@ class Tag extends DatabaseObject implements IRouteController { AND name = ?"; $statement = WCF::getDB()->prepareStatement($sql); $statement->execute([$languageID, $name]); - $row = $statement->fetchArray(); - if ($row !== false) return new Tag(null, $row); - return null; + return $statement->fetchObject(Tag::class); } /** -- 2.20.1