https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19809

--- Comment #14 from Julian Maurice <[email protected]> ---
(In reply to Marcel de Rooy from comment #13)
> Hi Julian,
> This might have been a bit overcautious, you are right.
> But looking at the code, I still see some problems:
> 
> +    @pars = grep { defined } @pars;
> This is not the same as the earlier check:
> -    return if !@pars || none { defined($_) } @pars;
> Btw note that this statement would return an empty list (with the croak
> removed).

Yes, but the croak is there, so if we reach this line it means we're in scalar
context, so it would return undef.
Also, I am failing to see what the differences are between the two checks. In
both cases, if @pars is empty or contain only undefined values, the rest of the
subroutine is not executed. Can you give a value of @pars for which the
behavior differ ?

> 
>      return $object;
> This is no longer good. Since you are returning 'undef' here literally while
> you want to return empty list if it is list context.

I do not want to return an empty list. I want Koha::Objects::find to behave
like DBIx::Class::ResultSet::find, which returns undef if no results were found
(even if in list context)

-- 
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[email protected]
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to