summaryrefslogtreecommitdiffstats
path: root/web
diff options
context:
space:
mode:
authorEli Schwartz <eschwartz@archlinux.org>2021-02-17 03:42:23 +0100
committerLukas Fleischer <lfleischer@archlinux.org>2021-02-20 17:22:11 +0100
commitd92dd69aa3c23acc7e2e409decf42c3b3e37749c (patch)
tree53ddceef5e3d60ea076e1541c2bddd1183f91f4a /web
parentd5e308550ad4682829c01feb32212540a6699100 (diff)
downloadaur-d92dd69aa3c23acc7e2e409decf42c3b3e37749c.tar.gz
aur-d92dd69aa3c23acc7e2e409decf42c3b3e37749c.tar.xz
fix broken SQL query that always failed
Due to missing whitespace at the end of strings during joining, we ended up with the query fragment "DelTS IS NULLAND NOT PinnedTS" which should be "DelTS IS NULL AND NOT PinnedTS" So the check for pinned comments > 5 likely always failed. In php 7, a completely broken query that raises exceptions in the database engine was silently ignored... in php 8, it raises Uncaught PDOException: SQLSTATE[HY000]: General error: 1 near "PinnedTS": syntax error in <file> and aborts the page building. End result: users with permission to pin comments cannot see any comments, or indeed page content below the first comment header Signed-off-by: Eli Schwartz <eschwartz@archlinux.org> Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
Diffstat (limited to 'web')
-rw-r--r--web/lib/pkgbasefuncs.inc.php2
1 files changed, 1 insertions, 1 deletions
diff --git a/web/lib/pkgbasefuncs.inc.php b/web/lib/pkgbasefuncs.inc.php
index a4925891..4c8abba7 100644
--- a/web/lib/pkgbasefuncs.inc.php
+++ b/web/lib/pkgbasefuncs.inc.php
@@ -21,7 +21,7 @@ function pkgbase_comments_count($base_id, $include_deleted, $only_pinned=false)
$q = "SELECT COUNT(*) FROM PackageComments ";
$q.= "WHERE PackageBaseID = " . $base_id . " ";
if (!$include_deleted) {
- $q.= "AND DelTS IS NULL";
+ $q.= "AND DelTS IS NULL ";
}
if ($only_pinned) {
$q.= "AND NOT PinnedTS = 0";