[aur-dev] [PATCH 4/4] make return value consistent for this function

Lukas Fleischer archlinux at cryptocrack.de
Wed May 11 10:31:41 EDT 2011


On Tue, May 10, 2011 at 09:01:30PM -0700, elij wrote:
> ---
>  web/lib/aur.inc |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/web/lib/aur.inc b/web/lib/aur.inc
> index fb267af..f8fa715 100644
> --- a/web/lib/aur.inc
> +++ b/web/lib/aur.inc
> @@ -196,7 +196,7 @@ function uid_from_sid($sid="") {
>  	$q.= "AND Sessions.SessionID = '" . mysql_real_escape_string($sid) . "'";
>  	$result = db_query($q, $dbh);
>  	if (!$result) {
> -		return 0;
> +		return "";
>  	}
>  	$row = mysql_fetch_row($result);
>  

Yes, that is one of the code parts that really suck. Returning zero or
an empty string in a function that is called uid_from_sid() is just
nonsense. I started refactoring this, replacing all zeros and empty
strings in functions that are designed to return IDs by "null" but
didn't ever finish that since I didn't have enough time to check and fix
all invocations, also (some of them compare to "0" and stuff).

It would be cool to have someone looking into that :)


More information about the aur-dev mailing list