X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FDatabase%2FDatabase.php;h=28283b1c8175d8273d980c0ffe17b021b8074cdc;hb=f26226229a45af4053055b8a5ea7aa0f7aa33e0c;hp=5b488e11f1543e18b80d9071f14e908a2716afa6;hpb=71a0c52dc338213f81a17e95ef166d56f2d6bc40;p=friendica.git diff --git a/src/Database/Database.php b/src/Database/Database.php index 5b488e11f1..28283b1c81 100644 --- a/src/Database/Database.php +++ b/src/Database/Database.php @@ -1267,7 +1267,7 @@ class Database * @param string|array $table Table name or array [schema => table] * @param array $fields contains the fields that are updated * @param array $condition condition array with the key values - * @param array|boolean $old_fields array with the old field values that are about to be replaced (true = update on duplicate) + * @param array|boolean $old_fields array with the old field values that are about to be replaced (true = update on duplicate, false = don't update identical fields) * * @return boolean was the update successfull? * @throws \Exception @@ -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']; + } } /**