]> git.mxchange.org Git - friendica.git/blobdiff - src/Database/Database.php
Merge pull request #10723 from annando/issue-9871-photos
[friendica.git] / src / Database / Database.php
index 361a3248d9ce40a00b518fed988072108ef4ae20..28283b1c8175d8273d980c0ffe17b021b8074cdc 100644 (file)
@@ -1461,8 +1461,12 @@ class Database
 
                $row = $this->fetchFirst($sql, $condition);
 
-               // Ensure to always return either a "null" or a numeric value
-               return is_numeric($row['count']) ? (int)$row['count'] : $row['count'];
+               if (!isset($row['count'])) {
+                       $this->logger->notice('Invalid count.', ['table' => $table, 'row' => $row, 'expression' => $expression, 'condition' => $condition_string, 'callstack' => System::callstack()]);
+                       return 0;
+               } else {
+                       return (int)$row['count'];
+               }
        }
 
        /**