Koha-clms/catalogue
Tomás Cohen Arazi 1839189b1c
Bug 35142: (follow-up) Fix detail page crash with invalid metadata
The staff catalogue detail page called $biblio->normalized_upc,
normalized_ean, and normalized_oclc unconditionally. These methods
go through metadata_extractor which calls $biblio->metadata->record
internally, re-fetching the (corrupt) metadata from the DB and
ignoring the already-sanitized $marc_record.

When a record has invalid MARCXML, this causes an unhandled exception
instead of displaying the 'biberror' warning.

Fix: use the Extractor directly with the already-recovered
$marc_record (which was sanitized via StripNonXmlChars), and guard
the block with a check that $marc_record is defined.

Test plan:
1. Apply patch
2. Run:
   $ ktd --proxy --selenium up -d
   $ ktd --wait-ready 120
   $ ktd --shell
   k$ prove t/db_dependent/selenium/regressions.t
=> SUCCESS: Tests pass (including 'detail page must not explode')
3. Sign off :-D

Signed-off-by: Pedro Amorim <pedro.amorim@openfifth.co.uk>
2026-09-03 10:56:48 +00:00
..
ISBDdetail.pl Bug 37762: Hook to holds preparation: DRY holdfor and searchToOrder 2026-05-08 12:25:42 -06:00
MARCdetail.pl Bug 37762: Hook to holds preparation: DRY holdfor and searchToOrder 2026-05-08 12:25:42 -06:00
detail.pl Bug 35142: (follow-up) Fix detail page crash with invalid metadata 2026-09-03 10:56:48 +00:00
export.pl Bug 39485: Fix wide character in print-warn in opac-export 2025-04-23 09:35:13 +02:00
image.pl Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
imageviewer.pl Bug 37762: Hook to holds preparation: DRY holdfor and searchToOrder 2026-05-08 12:25:42 -06:00
issuehistory.pl Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
item-export.pl Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
itemsearch.pl Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
labeledMARCdetail.pl Bug 37762: Hook to holds preparation: DRY holdfor and searchToOrder 2026-05-08 12:25:42 -06:00
moredetail.pl Bug 32773: Add fast cataloging support for multiple frameworks 2026-05-08 16:05:36 -06:00
search-history.pl Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
search.pl Bug 37762: Circulation: Hook to holds 2026-05-08 12:25:43 -06:00
showelastic.pl Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
showmarc.pl Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
stockrotation.pl Bug 42282: (QA follow-up) restore searchid in stockrotation 2026-06-29 16:20:07 +00:00
updateitem.pl Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00