[aur-dev] [PATCH] Fix empty depends database insert

Manuel Tortosa manutortosa at gmail.com
Wed Jun 29 15:52:07 EDT 2011


In pkgsubmit.php in this part:

foreach ($depends as $dep) {
	$deppkgname = preg_replace("/(<|<=|=|>=|>).*/", "", $dep);
	$depcondition = str_replace($deppkgname, "", $dep);

	if ($deppkgname == "#") {
		break;
	}

	$q = sprintf("INSERT INTO PackageDepends (PackageID, DepName, 		
DepCondition) VALUES (%d, '%s', '%s')",
	$packageID,
	mysql_real_escape_string($deppkgname),
	mysql_real_escape_string($depcondition));

	db_query($q, $dbh);
}

This will pass through the loop at least once in case of pkgdesc=(), adding an 
empty pkgdepends entry to the database. 

Easy to avoid by the fact $depends = explode(" ", $new_pkgbuild['depends']);
returns false.

Best Regards.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Fix-empty-database-insert-in-case-of-depends-in-pkgs.patch
Type: text/x-patch
Size: 828 bytes
Desc: not available
URL: <http://mailman.archlinux.org/pipermail/aur-dev/attachments/20110629/2f2a2945/attachment.bin>


More information about the aur-dev mailing list