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

--- Comment #2 from Adolfo Rodríguez Taboada <[email protected]> ---
Created attachment 211633
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=211633&action=edit
Bug 44074: Guard undecodable more_subfields_xml in Koha::Item

Bug 43024 guards C4::Items::_parse_unlinked_item_subfields_from_xml
against undecodable items.more_subfields_xml. The same column is decoded
without error handling in two more places:

- Koha::Item->columns_to_str called MARC::Record->new_from_xml with no
  eval, so one item with corrupt more_subfields_xml made the whole call
  die.
- Koha::Item::Attributes->new_from_marcxml (used by
  Koha::Item->additional_attributes) also died on undecodable XML, and
  additionally died on well-formed XML that has no 999 field.

Catch the error, log it with Koha::Logger (with the itemnumber where it
is known) and carry on without the unlinked subfields.

To test:
1. Apply the patch (and bug 43024) and restart_all
2. prove t/db_dependent/Koha/Item.t t/db_dependent/Koha/Item/Attributes.t
   => SUCCESS: Tests pass
3. Corrupt an item's more_subfields_xml directly in the database
   (for example truncate it) and view the record's items
   => The page still works, the item is shown without its unlinked
      subfields and a warning is logged

Sponsored-by: OpenFifth

Co-Authored-By: Claude Sonnet 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