[Bug 43943] New: Koha::Z3950Responder::Session->add_item_status uses next instead of return
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43943 Bug ID: 43943 Summary: Koha::Z3950Responder::Session->add_item_status uses next instead of return Initiative type: --- Sponsorship --- status: Product: Koha Version: Main Hardware: All OS: All Status: NEW Severity: minor Priority: P5 - low Component: Z39.50 / SRU / OpenSearch Servers Assignee: koha-bugs@lists.koha-community.org Reporter: adolfo.rodriguez@xercode.es QA Contact: testopia@bugs.koha-community.org CC: m.de.rooy@rijksmuseum.nl Target Milestone: --- Koha::Z3950Responder::Session->add_item_status skips the item fields without an itemnumber with: next unless $itemnumber; next inside a subroutine exits it and jumps to the next iteration of the caller's loop, with the warning "Exiting subroutine via next". It only works because the only caller (fetch_handler) calls it inside a foreach loop over the item fields, and it would die if called outside a loop. It should be a return, as the method already does a few lines below when the item does not exist. -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43943 Adolfo Rodríguez Taboada <adolfo.rodriguez@xercode.es> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |Needs Signoff Assignee|koha-bugs@lists.koha-commun |adolfo.rodriguez@xercode.es |ity.org | -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43943 --- Comment #1 from Adolfo Rodríguez Taboada <adolfo.rodriguez@xercode.es> --- Created attachment 209723 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=209723&action=edit Bug 43943: Use return instead of next in Koha::Z3950Responder::Session->add_item_status add_item_status skipped the item fields without an itemnumber with 'next unless $itemnumber'. Using next inside a subroutine exits it and jumps to the next iteration of the caller's loop, with the warning "Exiting subroutine via next". It only worked because the only caller calls it inside a foreach loop, and it would die if called outside a loop. This patch uses return instead, as the method already does a few lines below when the item does not exist. Steps to follow: 1. Apply the patch. 2. prove t/db_dependent/Koha/Z3950Responder/ 3. All the tests pass. 4. Revert the change in Koha/Z3950Responder/Session.pm and repeat step 2: the add_item_status subtest stops after 3 tests ("Looks like you planned 5 tests but ran 3") and Test::NoWarnings reports "Exiting subroutine via next". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Adolfo Rodríguez <adolfo.rodriguez@xercode.es> -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org