[Bug 13934] New: Check in fails on master "Can't bless non-reference at .../ItemType.pm Line 64"
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13934 Bug ID: 13934 Summary: Check in fails on master "Can't bless non-reference at .../ItemType.pm Line 64" Change sponsored?: --- Product: Koha Version: master Hardware: All OS: All Status: NEW Severity: critical Priority: P5 - low Component: Circulation Assignee: koha-bugs@lists.koha-community.org Reporter: nick@quecheelibrary.org QA Contact: testopia@bugs.koha-community.org CC: gmcharlt@gmail.com, kyle.m.hall@gmail.com Check in some barcodes on master and you get the perl error above tcohen says git bisect points to 7431f8cfe29e330e2232b0df591afc4d923b0a52 -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13934 Nick Clemens <nick@quecheelibrary.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |13885 -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13934 Jonathan Druart <jonathan.druart@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED CC| |jonathan.druart@biblibre.co | |m Assignee|koha-bugs@lists.koha-commun |jonathan.druart@biblibre.co |ity.org |m -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13934 Jonathan Druart <jonathan.druart@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Patch complexity|--- |Small patch Status|ASSIGNED |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13934 --- Comment #1 from Jonathan Druart <jonathan.druart@biblibre.com> --- Created attachment 37412 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=37412&action=edit Bug 13934: C4::ItemType->get should return undef if no parameter given The issue: If you try to check in an item with a non existent barcode, the application will exploded with a software error: "Can't bless non-reference at .../ItemType.pm Line 64". It's caused by: commit 7431f8cfe29e330e2232b0df591afc4d923b0a52 Bug 11944: Fix encoding issue in C4::ItemType and the following change: @@ -105,9 +104,6 @@ sub get { my $data = $dbh->selectrow_hashref( "SELECT * FROM itemtypes WHERE itemtype = ?", undef, $itemtype ); - if ( $data->{description} ) { - $data->{description} = Encode::encode('UTF-8', $data->{description}); - } because of the following: my $s; $s->{foo} = "bar" if $s->{foo}; use Data::Dumper;warn Dumper $s; => {} # not undef So later, bless $opts => $class; will fail because $opts is undef and was not (i.e. {}) before. Test plan: Try to check in an item with a non existent barcode and confirm you have the friendly warning message instead of the ugly software error. Note for QA: C4::ItemType->get is only uses in circ/return.pl. So even if the behavior is changed, it should not introduce any regression somewhere else. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13934 Jonathan Druart <jonathan.druart@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Depends on| |11944 -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13934 --- Comment #2 from M. Tompsett <mtompset@hotmail.com> --- Comment on attachment 37412 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=37412 Bug 13934: C4::ItemType->get should return undef if no parameter given Review of attachment 37412: --> (http://bugs.koha-community.org/bugzilla3/page.cgi?id=splinter.html&bug=13934&attachment=37412) ----------------------------------------------------------------- ::: C4/ItemType.pm @@ +99,5 @@
sub get { my ($class, $itemtype) = @_; + + return unless $itemtype;
Hypothetical question: Could not someone do something crazy like have an itemtype code of 0? -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13934 M. Tompsett <mtompset@hotmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13934 M. Tompsett <mtompset@hotmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #37412|0 |1 is obsolete| | --- Comment #3 from M. Tompsett <mtompset@hotmail.com> --- Created attachment 37427 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=37427&action=edit Bug 13934: C4::ItemType->get should return undef if no parameter given The issue: If you try to check in an item with a non existent barcode, the application will exploded with a software error: "Can't bless non-reference at .../ItemType.pm Line 64". It's caused by: commit 7431f8cfe29e330e2232b0df591afc4d923b0a52 Bug 11944: Fix encoding issue in C4::ItemType and the following change: @@ -105,9 +104,6 @@ sub get { my $data = $dbh->selectrow_hashref( "SELECT * FROM itemtypes WHERE itemtype = ?", undef, $itemtype ); - if ( $data->{description} ) { - $data->{description} = Encode::encode('UTF-8', $data->{description}); - } because of the following: my $s; $s->{foo} = "bar" if $s->{foo}; use Data::Dumper;warn Dumper $s; => {} # not undef So later, bless $opts => $class; will fail because $opts is undef and was not (i.e. {}) before. More explicit test plan: 1) Log in to staff client 2) Circulation -> Check in 3) Type a non-existent barcode into 'Enter item barcode:' textbox 4) Click 'Submit' -- Should receive nasty error. 5) apply patch 6) repeat steps 2-4 -- Should be told 'No item with barcode: {what you typed}' 7) prove -v t/ItemType.t -- All tests should run successfully. 7) run koha qa test tools Note: Having tried to create and use an itemtype '0', this only demonstrates a lack of validation on the itemtype creation screen. Unable to use it without tweaking back end. That is beyond the scope of this bug. Note for QA: C4::ItemType->get is only uses in circ/return.pl. So even if the behavior is changed, it should not introduce any regression somewhere else. Signed-off-by: Mark Tompsett <mtompset@hotmail.com> -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13934 Kyle M Hall <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Passed QA -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13934 Kyle M Hall <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #37427|0 |1 is obsolete| | --- Comment #4 from Kyle M Hall <kyle@bywatersolutions.com> --- Created attachment 37452 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=37452&action=edit [PASSED QA] Bug 13934: C4::ItemType->get should return undef if no parameter given The issue: If you try to check in an item with a non existent barcode, the application will exploded with a software error: "Can't bless non-reference at .../ItemType.pm Line 64". It's caused by: commit 7431f8cfe29e330e2232b0df591afc4d923b0a52 Bug 11944: Fix encoding issue in C4::ItemType and the following change: @@ -105,9 +104,6 @@ sub get { my $data = $dbh->selectrow_hashref( "SELECT * FROM itemtypes WHERE itemtype = ?", undef, $itemtype ); - if ( $data->{description} ) { - $data->{description} = Encode::encode('UTF-8', $data->{description}); - } because of the following: my $s; $s->{foo} = "bar" if $s->{foo}; use Data::Dumper;warn Dumper $s; => {} # not undef So later, bless $opts => $class; will fail because $opts is undef and was not (i.e. {}) before. More explicit test plan: 1) Log in to staff client 2) Circulation -> Check in 3) Type a non-existent barcode into 'Enter item barcode:' textbox 4) Click 'Submit' -- Should receive nasty error. 5) apply patch 6) repeat steps 2-4 -- Should be told 'No item with barcode: {what you typed}' 7) prove -v t/ItemType.t -- All tests should run successfully. 7) run koha qa test tools Note: Having tried to create and use an itemtype '0', this only demonstrates a lack of validation on the itemtype creation screen. Unable to use it without tweaking back end. That is beyond the scope of this bug. Note for QA: C4::ItemType->get is only uses in circ/return.pl. So even if the behavior is changed, it should not introduce any regression somewhere else. Signed-off-by: Mark Tompsett <mtompset@hotmail.com> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13934 Jonathan Druart <jonathan.druart@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Passed QA |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13934 Jonathan Druart <jonathan.druart@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #37452|0 |1 is obsolete| | --- Comment #5 from Jonathan Druart <jonathan.druart@biblibre.com> --- Created attachment 37536 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=37536&action=edit Bug 13934: C4::ItemType->get should return undef if no parameter given The issue: If you try to check in an item with a non existent barcode, the application will exploded with a software error: "Can't bless non-reference at .../ItemType.pm Line 64". It's caused by: commit 7431f8cfe29e330e2232b0df591afc4d923b0a52 Bug 11944: Fix encoding issue in C4::ItemType and the following change: @@ -105,9 +104,6 @@ sub get { my $data = $dbh->selectrow_hashref( "SELECT * FROM itemtypes WHERE itemtype = ?", undef, $itemtype ); - if ( $data->{description} ) { - $data->{description} = Encode::encode('UTF-8', $data->{description}); - } because of the following: my $s; $s->{foo} = "bar" if $s->{foo}; use Data::Dumper;warn Dumper $s; => {} # not undef So later, bless $opts => $class; will fail because $opts is undef and was not (i.e. {}) before. More explicit test plan: 1) Log in to staff client 2) Circulation -> Check in 3) Type a non-existent barcode into 'Enter item barcode:' textbox 4) Click 'Submit' -- Should receive nasty error. 5) apply patch 6) repeat steps 2-4 -- Should be told 'No item with barcode: {what you typed}' 7) prove -v t/ItemType.t -- All tests should run successfully. 7) run koha qa test tools Note: Having tried to create and use an itemtype '0', this only demonstrates a lack of validation on the itemtype creation screen. Unable to use it without tweaking back end. That is beyond the scope of this bug. Note for QA: C4::ItemType->get is only uses in circ/return.pl. So even if the behavior is changed, it should not introduce any regression somewhere else. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13934 --- Comment #6 from Jonathan Druart <jonathan.druart@biblibre.com> --- (In reply to M. Tompsett from comment #2)
Hypothetical question: Could not someone do something crazy like have an itemtype code of 0?
I think this is consistent. The last patch replaced the line return unless $itemtype; with return unless defined $itemtype; -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13934 --- Comment #7 from Josef Moravec <josef.moravec@gmail.com> --- Created attachment 37558 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=37558&action=edit [SIGNED-OFF] Bug 13934: C4::ItemType->get should return undef if no parameter given The issue: If you try to check in an item with a non existent barcode, the application will exploded with a software error: "Can't bless non-reference at .../ItemType.pm Line 64". It's caused by: commit 7431f8cfe29e330e2232b0df591afc4d923b0a52 Bug 11944: Fix encoding issue in C4::ItemType and the following change: @@ -105,9 +104,6 @@ sub get { my $data = $dbh->selectrow_hashref( "SELECT * FROM itemtypes WHERE itemtype = ?", undef, $itemtype ); - if ( $data->{description} ) { - $data->{description} = Encode::encode('UTF-8', $data->{description}); - } because of the following: my $s; $s->{foo} = "bar" if $s->{foo}; use Data::Dumper;warn Dumper $s; => {} # not undef So later, bless $opts => $class; will fail because $opts is undef and was not (i.e. {}) before. More explicit test plan: 1) Log in to staff client 2) Circulation -> Check in 3) Type a non-existent barcode into 'Enter item barcode:' textbox 4) Click 'Submit' -- Should receive nasty error. 5) apply patch 6) repeat steps 2-4 -- Should be told 'No item with barcode: {what you typed}' 7) prove -v t/ItemType.t -- All tests should run successfully. 7) run koha qa test tools Note: Having tried to create and use an itemtype '0', this only demonstrates a lack of validation on the itemtype creation screen. Unable to use it without tweaking back end. That is beyond the scope of this bug. Note for QA: C4::ItemType->get is only uses in circ/return.pl. So even if the behavior is changed, it should not introduce any regression somewhere else. Signed-off-by: Josef Moravec <josef.moravec@gmail.com> -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13934 Josef Moravec <josef.moravec@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off CC| |josef.moravec@gmail.com -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13934 Josef Moravec <josef.moravec@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #37536|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13934 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #37558|0 |1 is obsolete| | --- Comment #8 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 37630 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=37630&action=edit [SIGNED OFF] Bug 13934: C4::ItemType->get should return undef if no parameter given The issue: If you try to check in an item with a non existent barcode, the application will exploded with a software error: "Can't bless non-reference at .../ItemType.pm Line 64". It's caused by: commit 7431f8cfe29e330e2232b0df591afc4d923b0a52 Bug 11944: Fix encoding issue in C4::ItemType and the following change: @@ -105,9 +104,6 @@ sub get { my $data = $dbh->selectrow_hashref( "SELECT * FROM itemtypes WHERE itemtype = ?", undef, $itemtype ); - if ( $data->{description} ) { - $data->{description} = Encode::encode('UTF-8', $data->{description}); - } because of the following: my $s; $s->{foo} = "bar" if $s->{foo}; use Data::Dumper;warn Dumper $s; => {} # not undef So later, bless $opts => $class; will fail because $opts is undef and was not (i.e. {}) before. More explicit test plan: 1) Log in to staff client 2) Circulation -> Check in 3) Type a non-existent barcode into 'Enter item barcode:' textbox 4) Click 'Submit' -- Should receive nasty error. 5) apply patch 6) repeat steps 2-4 -- Should be told 'No item with barcode: {what you typed}' 7) prove -v t/ItemType.t -- All tests should run successfully. 7) run koha qa test tools Note: Having tried to create and use an itemtype '0', this only demonstrates a lack of validation on the itemtype creation screen. Unable to use it without tweaking back end. That is beyond the scope of this bug. Note for QA: C4::ItemType->get is only uses in circ/return.pl. So even if the behavior is changed, it should not introduce any regression somewhere else. Signed-off-by: Josef Moravec <josef.moravec@gmail.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com> Works as expected. Fixes the problem and no regressions found. It even has regression tests :-D -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13934 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Passed QA -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13934 --- Comment #9 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- Created attachment 37631 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=37631&action=edit [PASSED QA] Bug 13934: C4::ItemType->get should return undef if no parameter given The issue: If you try to check in an item with a non existent barcode, the application will exploded with a software error: "Can't bless non-reference at .../ItemType.pm Line 64". It's caused by: commit 7431f8cfe29e330e2232b0df591afc4d923b0a52 Bug 11944: Fix encoding issue in C4::ItemType and the following change: @@ -105,9 +104,6 @@ sub get { my $data = $dbh->selectrow_hashref( "SELECT * FROM itemtypes WHERE itemtype = ?", undef, $itemtype ); - if ( $data->{description} ) { - $data->{description} = Encode::encode('UTF-8', $data->{description}); - } because of the following: my $s; $s->{foo} = "bar" if $s->{foo}; use Data::Dumper;warn Dumper $s; => {} # not undef So later, bless $opts => $class; will fail because $opts is undef and was not (i.e. {}) before. More explicit test plan: 1) Log in to staff client 2) Circulation -> Check in 3) Type a non-existent barcode into 'Enter item barcode:' textbox 4) Click 'Submit' -- Should receive nasty error. 5) apply patch 6) repeat steps 2-4 -- Should be told 'No item with barcode: {what you typed}' 7) prove -v t/ItemType.t -- All tests should run successfully. 7) run koha qa test tools Note: Having tried to create and use an itemtype '0', this only demonstrates a lack of validation on the itemtype creation screen. Unable to use it without tweaking back end. That is beyond the scope of this bug. Note for QA: C4::ItemType->get is only uses in circ/return.pl. So even if the behavior is changed, it should not introduce any regression somewhere else. Signed-off-by: Josef Moravec <josef.moravec@gmail.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com> Works as expected. Fixes the problem and no regressions found. It even has regression tests :-D Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13934 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |tomascohen@gmail.com Attachment #37630|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13934 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Passed QA |Pushed to Master --- Comment #10 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Patch pushed to master. Thanks Jonathan! -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13934 Chris Cormack <chris@bigballofwax.co.nz> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |chris@bigballofwax.co.nz Status|Pushed to Master |Pushed to Stable --- Comment #11 from Chris Cormack <chris@bigballofwax.co.nz> --- Pushed to 3.18.x will be in 3.18.6 -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13934 Bug 13934 depends on bug 11944, which changed state. Bug 11944 Summary: Cleanup Koha UTF-8 http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11944 What |Removed |Added ---------------------------------------------------------------------------- Status|Pushed to Master |RESOLVED Resolution|--- |FIXED -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org