summaryrefslogtreecommitdiffstats
path: root/web
diff options
context:
space:
mode:
authorLukas Fleischer <archlinux@cryptocrack.de>2011-04-05 11:38:43 +0200
committerLukas Fleischer <archlinux@cryptocrack.de>2011-04-05 11:38:43 +0200
commit8cd2aef50d96ee68dc08738a4ddf94ed58f28db4 (patch)
tree03ee6621d4e332fe15fead22e63e1fb5050f661e /web
parent8b4b2d207e8b1ff1a9ad13ace726ac7ff1510a29 (diff)
downloadaur-8cd2aef50d96ee68dc08738a4ddf94ed58f28db4.tar.gz
aur-8cd2aef50d96ee68dc08738a4ddf94ed58f28db4.tar.xz
Initialize "$name" in pkgname_from_id().
Ensures "$name" is always initialized, even if the package doesn't exist. Fixes PHP warnings appearing when retrieving package details of a package with an invalid ID. Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
Diffstat (limited to 'web')
-rw-r--r--web/lib/pkgfuncs.inc3
1 files changed, 1 insertions, 2 deletions
diff --git a/web/lib/pkgfuncs.inc b/web/lib/pkgfuncs.inc
index d9e2c13f..e4323554 100644
--- a/web/lib/pkgfuncs.inc
+++ b/web/lib/pkgfuncs.inc
@@ -251,14 +251,13 @@ function pkgnotify_from_sid($sid="") {
#
function pkgname_from_id($pkgid=0) {
$pkgid = intval($pkgid);
+ $name = "";
if ($pkgid > 0) {
$dbh = db_connect();
$q = "SELECT Name FROM Packages WHERE ID = " . $pkgid;
$result = db_query($q, $dbh);
if (mysql_num_rows($result) > 0) {
$name = mysql_result($result, 0);
- } else {
- $name = "";
}
}
return $name;