Incorrect return value for an empty list of likes
authorMarcel Werk <burntime@woltlab.com>
Wed, 6 May 2020 18:43:36 +0000 (20:43 +0200)
committerMarcel Werk <burntime@woltlab.com>
Wed, 6 May 2020 18:43:36 +0000 (20:43 +0200)
wcfsetup/install/files/lib/system/like/LikeHandler.class.php

index 1e0d90ab1d8a265da955f40b2f6a22a3fd923919..a46d92ca4fcea8ab25cc52d8cba7b9ac24a0662e 100644 (file)
@@ -513,6 +513,16 @@ class LikeHandler extends SingletonFactory {
                        $likeObject->likeObjectID
                ]);
                
-               return $statement->fetchArray();
+               $row = $statement->fetchSingleRow();
+               if ($row === false) {
+                       $row = [
+                               'likes' => 0,
+                               'dislikes' => 0,
+                               'cumulativeLikes' => 0,
+                               'liked' => 0,
+                       ];
+               }
+               
+               return $row;
        }
 }