From 8cd2aef50d96ee68dc08738a4ddf94ed58f28db4 Mon Sep 17 00:00:00 2001 From: Lukas Fleischer Date: Tue, 5 Apr 2011 11:38:43 +0200 Subject: 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 --- web/lib/pkgfuncs.inc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'web') diff --git a/web/lib/pkgfuncs.inc b/web/lib/pkgfuncs.inc index d9e2c13..e432355 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; -- cgit v1.2.3-70-g09d2