summaryrefslogtreecommitdiffstats
path: root/web/lib/pkgfuncs.inc.php
diff options
context:
space:
mode:
authorEli Schwartz <eschwartz@archlinux.org>2020-02-12 21:16:37 +0100
committerLukas Fleischer <lfleischer@archlinux.org>2020-02-13 09:11:28 +0100
commit5ca1e271f9023b41b613313745bc700dc15d802f (patch)
tree4974b28d4e5337b125ea76104cd55d16fc38fe15 /web/lib/pkgfuncs.inc.php
parent65c98d12161906ab680fc2c9572f7c78b16efd82 (diff)
downloadaur-5ca1e271f9023b41b613313745bc700dc15d802f.tar.gz
aur-5ca1e271f9023b41b613313745bc700dc15d802f.tar.xz
Fix PHP 7.4 warnings
If a db query returned NULL instead of an array, then accessing $row[0] now throws a warning. The undocumented behavior of evaluating to NULL is maintained, and we want to return NULL anyway, so add a check for the value and fall back on the default function return type. Signed-off-by: Eli Schwartz <eschwartz@archlinux.org> Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
Diffstat (limited to 'web/lib/pkgfuncs.inc.php')
-rw-r--r--web/lib/pkgfuncs.inc.php4
1 files changed, 3 insertions, 1 deletions
diff --git a/web/lib/pkgfuncs.inc.php b/web/lib/pkgfuncs.inc.php
index a4cd17ac..8c915711 100644
--- a/web/lib/pkgfuncs.inc.php
+++ b/web/lib/pkgfuncs.inc.php
@@ -147,7 +147,9 @@ function pkg_from_name($name="") {
return;
}
$row = $result->fetch(PDO::FETCH_NUM);
- return $row[0];
+ if ($row) {
+ return $row[0];
+ }
}
/**