diff options
author | Joas Schilling <coding@schilljs.com> | 2023-01-20 07:41:19 +0100 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2023-01-20 07:41:19 +0100 |
commit | 7f0a54c5581b3bde0f271d6e6a549076f14354dc (patch) | |
tree | cb1904d42039a2db231382e45b56a6228ded79d9 /lib/private/DB/QueryBuilder | |
parent | 5e3a3c0c8faa45489aa6ac610728b4177501c198 (diff) | |
download | nextcloud-server-7f0a54c5581b3bde0f271d6e6a549076f14354dc.tar.gz nextcloud-server-7f0a54c5581b3bde0f271d6e6a549076f14354dc.zip |
fix(querybuilder): Log a warning if where() is called again on a query builder object
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib/private/DB/QueryBuilder')
-rw-r--r-- | lib/private/DB/QueryBuilder/QueryBuilder.php | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/private/DB/QueryBuilder/QueryBuilder.php b/lib/private/DB/QueryBuilder/QueryBuilder.php index e81ba61b3a7..9713410806e 100644 --- a/lib/private/DB/QueryBuilder/QueryBuilder.php +++ b/lib/private/DB/QueryBuilder/QueryBuilder.php @@ -865,6 +865,12 @@ class QueryBuilder implements IQueryBuilder { * @return $this This QueryBuilder instance. */ public function where(...$predicates) { + if ($this->getQueryPart('where') !== null && $this->systemConfig->getValue('debug', false)) { + // Only logging a warning, not throwing for now. + $e = new QueryException('Using where() on non-empty WHERE part, please verify it is intentional to not call whereAnd() or whereOr() instead. Otherwise consider creating a new query builder object or call resetQueryPart(\'where\') first.'); + $this->logger->warning($e->getMessage(), ['exception' => $e]); + } + call_user_func_array( [$this->queryBuilder, 'where'], $predicates |