[aur-dev] [PATCH] pkgsubmit.php: Refactor source processing to fix PHP notice

canyonknight canyonknight at gmail.com
Sat Jul 14 14:20:11 EDT 2012


A foreach() being run without checking to see if the uploaded PKGBUILD had any
sources now no longer causes an undefined index notice when there are no
sources.

Signed-off-by: canyonknight <canyonknight at gmail.com>
---
 web/html/pkgsubmit.php | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/web/html/pkgsubmit.php b/web/html/pkgsubmit.php
index c2a7191..737812e 100644
--- a/web/html/pkgsubmit.php
+++ b/web/html/pkgsubmit.php
@@ -379,9 +379,9 @@ if ($uid):
 			}
 
 			# Insert sources
-			$sources = explode(" ", $new_pkgbuild['source']);
-			foreach ($sources as $src) {
-				if ($src != "" ) {
+			if (!empty($new_pkgbuild['source'])) {
+				$sources = explode(" ", $new_pkgbuild['source']);
+				foreach ($sources as $src) {
 					add_pkg_src($packageID, $src, $dbh);
 				}
 			}
-- 
1.7.11.2



More information about the aur-dev mailing list