Bugzilla – Attachment 48986 Details for
Bug 16009
crash displaying pending offline circulations
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 16009: fix GetMember() search on NULL/undef values
Bug-16009-fix-GetMember-search-on-NULLundef-values.patch (text/plain), 2.23 KB, created by
Srdjan Jankovic
on 2016-03-11 01:05:18 UTC
(
hide
)
Description:
Bug 16009: fix GetMember() search on NULL/undef values
Filename:
MIME Type:
Creator:
Srdjan Jankovic
Created:
2016-03-11 01:05:18 UTC
Size:
2.23 KB
patch
obsolete
>From d58ce6423192090f9d48e6b0c263fee898f2715c Mon Sep 17 00:00:00 2001 >From: Galen Charlton <gmcharlt@gmail.com> >Date: Wed, 9 Mar 2016 01:41:33 +0000 >Subject: [PATCH] Bug 16009: fix GetMember() search on NULL/undef values > >This patch fixes a bug whereby GetMember(searchfield => undef) >(i.e., searching for patron records where 'searchfield' is NULL) >would crash. > >This fixes a regression introduced by bug 15344 that in turn >exposed a long-standing bug in GetMember(). > >To test: > >[1] Import some offline circulation transactions that include at > least one return. >[2] Attempt to view the list of pending transactions; a crash > will occur. >[3] Apply the patch and view the list of pending transactions again; > this time, it should work. > >Signed-off-by: Galen Charlton <gmcharlt@gmail.com> >Signed-off-by: Srdjan <srdjan@catalyst.net.nz> >--- > C4/Members.pm | 2 +- > t/db_dependent/Members.t | 10 +++++++++- > 2 files changed, 10 insertions(+), 2 deletions(-) > >diff --git a/C4/Members.pm b/C4/Members.pm >index cc438f0..884ee3d 100644 >--- a/C4/Members.pm >+++ b/C4/Members.pm >@@ -435,7 +435,7 @@ sub GetMember { > } > $debug && warn $select, " ",values %information; > my $sth = $dbh->prepare("$select"); >- $sth->execute(map{$information{$_}} keys %information); >+ $sth->execute(@values); > my $data = $sth->fetchall_arrayref({}); > #FIXME interface to this routine now allows generation of a result set > #so whole array should be returned but bowhere in the current code expects this >diff --git a/t/db_dependent/Members.t b/t/db_dependent/Members.t >index 146d563..97cf9e1 100755 >--- a/t/db_dependent/Members.t >+++ b/t/db_dependent/Members.t >@@ -17,7 +17,7 @@ > > use Modern::Perl; > >-use Test::More tests => 56; >+use Test::More tests => 58; > use Test::MockModule; > use Data::Dumper; > use C4::Context; >@@ -409,4 +409,12 @@ sub testAgeAccessors { > $member->{dateofbirth} = $original_dateofbirth; #It is polite to revert made changes in the unit tests. > } #sub testAgeAccessors > >+# regression test for bug 16009 >+my $patron; >+eval { >+ my $patron = GetMember(cardnumber => undef); >+}; >+is($@, '', 'Bug 16009: GetMember(cardnumber => undef) works'); >+is($patron, undef, 'Bug 16009: GetMember(cardnumber => undef) returns undef'); >+ > 1; >-- >1.9.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 16009
:
48832
|
48986
|
49000