[Koha-bugs] [Bug 8604] Patron cards made for patrons which don't have patron images use preceding card's image
bugzilla-daemon at bugs.koha-community.org
bugzilla-daemon at bugs.koha-community.org
Fri Jul 13 12:40:26 CEST 2018
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=8604
--- Comment #22 from Chris Nighswonger <cnighswonger at foundations.edu> ---
(In reply to Marcel de Rooy from comment #19)
> Chris:
> I have the impression
Just an impression? ;-) Did you test and find a case where this fix does not
work?
that you are clearing the wrong variables at the end
> of the for loop. You undef image, alt_image and binary_data. These three
> vars are all created in the for loop. I guess they should not present a
> problem? But $image_data is created outside the loop and is not cleared.
> Isn't that the cause of the issue?
I don't think so.
>
> Look at
> my $binary_data = $image_data->{'imagefile'}
>
> Since $image_data is not cleared, bad things may still happen??
$binary_data is a reference to $image_data->{'imagefile'} which, in turn, is a
reference to a hash created by DBI containing the results of the SELECT. DBI
creates a new hash on every row retrieval[1], ensuring that the data contained
at our reference is fresh every time.
Image::Magick, on the other hand, does not automatically "destroy" the original
structure on each call, and so we need to take care of that.[2]
[1] "By default a reference to a new hash is returned for each row."
https://metacpan.org/pod/DBI#fetchrow_hashref
[2] "Once you are finished with a PerlMagick object you should consider
destroying it." http://www.graphicsmagick.org/perl.html
--
You are receiving this mail because:
You are watching all bug changes.
More information about the Koha-bugs
mailing list