[Koha-bugs] [Bug 19809] Koha::Objects::find calls do not need to be forbidden in list context

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Tue Nov 5 16:57:49 CET 2019


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

--- Comment #15 from Marcel de Rooy <m.de.rooy at rijksmuseum.nl> ---
(In reply to Julian Maurice from comment #14)
> (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).
> 

> 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 ?

Yes, this is very theoretical.
You strip the @pars array now. Before we passed the original array unless it
only consisted of undefined values.
So suppose I pass 51, undef, 13. You are now passing 51, 13. Different thing!
Note that find responds to multiple column PKs and unique constraint stuff. (We
are probably not using in Koha.)

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list