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

--- Comment #1 from Adolfo Rodríguez Taboada <[email protected]> ---
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 <[email protected]>
Signed-off-by: Adolfo Rodríguez <[email protected]>

-- 
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list -- [email protected]
To unsubscribe send an email to [email protected]
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to