Bug 41706

Summary: "Use of uninitialized value..." warning in C4/Record.pm
Product: Koha Reporter: Roman Dolny <roman.dolny>
Component: OPACAssignee: Owen Leonard <oleonard>
Status: Needs Signoff --- QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low    
Version: Main   
Hardware: All   
OS: All   
GIT URL: Initiative type: ---
Sponsorship status: --- Comma delimited list of Sponsors:
Crowdfunding goal: 0 Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:
Attachments: Bug 41706: "Use of uninitialized value..." warning in C4/Record.pm

Description Roman Dolny 2026-01-25 13:16:24 UTC
The warning:
[WARN] Use of uninitialized value $2 in split
    at /kohadevbox/koha/C4/Record.pm line 924.
appears in the plack-opac-error.log file.

To reproduce in KTD:
1. Observe plack-opac-error.log
2. In OPAC go to record with one word author like Aristophanes,
   Aristotle or Xenophon (biblionumbers: 64, 176, 254)
3. Show it in any of "detail" view (Normal, MARC, ISBD)
4. Warning appears in plack-opac-error.log

It happens during the preparation of data for the "Cite" feature 
in OPAC. The warning appears because of the overlap of two regular 
expression matches - the variable captured from the first regular 
expression match is changed (by the second regular expression match) 
before it is used.
Comment 1 Roman Dolny 2026-01-25 14:14:21 UTC
Created attachment 192011 [details] [review]
Bug 41706: "Use of uninitialized value..." warning in C4/Record.pm

The warning:
[WARN] Use of uninitialized value $2 in split
    at /kohadevbox/koha/C4/Record.pm line 924.
appears in the plack-opac-error.log file.
It happens during the preparation of data for the "Cite" feature
in OPAC for some of author's fields.

To test:
========
1. Observe plack-opac-error.log.
2. In OPAC go to record with one word author like Aristophanes,
   Aristotle or Xenophon (biblionumbers: 64, 176, 254).
3. Show it in any of "detail" view (Normal, MARC, ISBD).
4. Warning appears in plack-opac-error.log.
5. Apply the patch; restart_all.
6. Repeat 2-3. Warning doesn't appear.

Sponsored-by: Ignatianum University in Cracow