diff --git a/lib/private/DB/Connection.php b/lib/private/DB/Connection.php index ebde26d396b..e0f4a1ddc56 100644 --- a/lib/private/DB/Connection.php +++ b/lib/private/DB/Connection.php @@ -317,7 +317,7 @@ class Connection extends PrimaryReadReplicaConnection { * @param array $params The query parameters. * @param array $types The parameter types. * - * @return int The number of affected rows. + * @return int The number of affected rows, if the result is bigger than PHP_INT_MAX, PHP_INT_MAX is returned * * @throws \Doctrine\DBAL\Exception */ diff --git a/lib/private/DB/QueryBuilder/QueryBuilder.php b/lib/private/DB/QueryBuilder/QueryBuilder.php index f47de8005aa..97f80baa244 100644 --- a/lib/private/DB/QueryBuilder/QueryBuilder.php +++ b/lib/private/DB/QueryBuilder/QueryBuilder.php @@ -187,7 +187,7 @@ class QueryBuilder implements IQueryBuilder { /** * Executes this query using the bound parameters and their types. * - * Uses {@see Connection::executeQuery} for select statements and {@see Connection::executeUpdate} + * Uses {@see Connection::executeQuery} for select statements and {@see Connection::executeStatement} * for insert, update and delete statements. * * @return IResult|int @@ -272,12 +272,10 @@ class QueryBuilder implements IQueryBuilder { if ($this->getType() !== self::SELECT) { $result = $this->queryBuilder->executeStatement(); - } else { - $result = $this->queryBuilder->executeQuery(); - } - if (is_int($result)) { - return $result; + return (int) $result; } + + $result = $this->queryBuilder->executeQuery(); return new ResultAdapter($result); } diff --git a/lib/private/DB/ResultAdapter.php b/lib/private/DB/ResultAdapter.php index 95a7620e0ff..158d802125a 100644 --- a/lib/private/DB/ResultAdapter.php +++ b/lib/private/DB/ResultAdapter.php @@ -56,6 +56,6 @@ class ResultAdapter implements IResult { } public function rowCount(): int { - return $this->inner->rowCount(); + return (int) $this->inner->rowCount(); } } diff --git a/lib/public/DB/IResult.php b/lib/public/DB/IResult.php index 347919ab336..ccff8c0cd18 100644 --- a/lib/public/DB/IResult.php +++ b/lib/public/DB/IResult.php @@ -69,9 +69,10 @@ interface IResult { public function fetchOne(); /** - * @return int + * @return int If the result is bigger than PHP_INT_MAX, PHP_INT_MAX is returned * * @since 21.0.0 + * @since 30.0.0 If the result is bigger than PHP_INT_MAX, PHP_INT_MAX is returned */ public function rowCount(): int; }