aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/DB
diff options
context:
space:
mode:
authorJoas Schilling <213943+nickvergessen@users.noreply.github.com>2023-01-23 18:47:25 +0100
committerGitHub <noreply@github.com>2023-01-23 18:47:25 +0100
commitecad09b38a152957c771139562e61f7ecb1a6879 (patch)
treecebd1bc850d8b702c895e07ff908131074d2e1f0 /lib/private/DB
parentc817981d7a144c2cb20f35c69156825e5367be58 (diff)
parent7f0a54c5581b3bde0f271d6e6a549076f14354dc (diff)
downloadnextcloud-server-ecad09b38a152957c771139562e61f7ecb1a6879.tar.gz
nextcloud-server-ecad09b38a152957c771139562e61f7ecb1a6879.zip
Merge pull request #36261 from nextcloud/techdebt/noid/warn-devs-about-potential-bugs
fix(querybuilder): Log a warning if where() is called again on a quer…
Diffstat (limited to 'lib/private/DB')
-rw-r--r--lib/private/DB/QueryBuilder/QueryBuilder.php6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/private/DB/QueryBuilder/QueryBuilder.php b/lib/private/DB/QueryBuilder/QueryBuilder.php
index 99eaed07488..43ed68f5616 100644
--- a/lib/private/DB/QueryBuilder/QueryBuilder.php
+++ b/lib/private/DB/QueryBuilder/QueryBuilder.php
@@ -864,6 +864,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