Bug 35423 - AuthoritiesMarc: Warnings substr outside of string and Use of uninitialized value $type in string eq
Summary: AuthoritiesMarc: Warnings substr outside of string and Use of uninitialized v...
Status: Pushed to main
Alias: None
Product: Koha
Classification: Unclassified
Component: Architecture, internals, and plumbing (show other bugs)
Version: Main
Hardware: All All
: P5 - low minor
Assignee: Lari Taskula
QA Contact: Katrin Fischer
URL:
Keywords: Academy
Depends on:
Blocks: 2505
  Show dependency treegraph
 
Reported: 2023-11-28 15:19 UTC by Marcel de Rooy
Modified: 2026-01-23 14:30 UTC (History)
1 user (show)

See Also:
GIT URL:
Initiative type: ---
Sponsorship status: ---
Comma delimited list of Sponsors:
Crowdfunding goal: 0
Patch complexity: Small patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
26.05.00
Circulation function:


Attachments
Bug 35423: Fix substr outside of string warning (1.76 KB, patch)
2025-10-21 19:40 UTC, Lari Taskula
Details | Diff | Splinter Review
Bug 35423: Fix substr outside of string warning (1.75 KB, patch)
2026-01-21 21:05 UTC, Harrison Hawkins
Details | Diff | Splinter Review
Bug 35423: Fix substr outside of string warning (1.82 KB, patch)
2026-01-21 21:19 UTC, Harrison Hawkins
Details | Diff | Splinter Review
Bug 35423: Fix substr outside of string warning (1.88 KB, patch)
2026-01-21 21:38 UTC, Katrin Fischer
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Marcel de Rooy 2023-11-28 15:19:04 UTC
In full:

substr outside of string at /usr/share/koha/C4/AuthoritiesMarc.pm line 1041.
Use of uninitialized value $type in string eq at /usr/share/koha/C4/AuthoritiesMarc.pm line 1044.

May be found in your logs (depending on data) when calling SearchAuthorities.
Comment 1 Lari Taskula 2025-10-21 19:40:10 UTC
Created attachment 188258 [details] [review]
Bug 35423: Fix substr outside of string warning

To test:

Before applying patch

1. Create an authority record, fill field 400$w with "n"
2. Search for the authority you just created
3. Observe a warning has been logged

"substr outside of string"

4. Apply patch
5. Refresh the search results from step 2
6. Observe no warnings have been logged
Comment 2 Aleisha Amohia 2026-01-21 04:01:13 UTC
Tip to recreate for tester, using KTD:

Go to http://localhost:8081/cgi-bin/koha/authorities/detail.pl?authid=1630

Edit record

Go to 400 tab and add "n" to 400$w

In your commandline, watch the log by running

tail -f /var/log/koha/kohadev/plack-intranet-error.log

Then go to Authorities and do a main heading search for "a"
Comment 3 Harrison Hawkins 2026-01-21 21:05:03 UTC
Created attachment 191831 [details] [review]
Bug 35423: Fix substr outside of string warning

To test:

Before applying patch

1. Create an authority record, fill field 400$w with "n"
2. Search for the authority you just created
3. Observe a warning has been logged

"substr outside of string"

4. Apply patch
5. Refresh the search results from step 2
6. Observe no warnings have been logged
Comment 4 Katrin Fischer 2026-01-21 21:13:10 UTC
Hi Harrison, it looks like you meant to sign this off, but your sign-off line is missing from the patch. If you use ktd you can fix this by:

- Create a branch and apply the patch
- git so 1
- git bz attach 35432 HEAD

You might also want to check what the sign-off line looks like to verify your email and name are set up as you want it :)
Comment 5 Harrison Hawkins 2026-01-21 21:19:39 UTC
Created attachment 191837 [details] [review]
Bug 35423: Fix substr outside of string warning

To test:

Before applying patch

1. Create an authority record, fill field 400$w with "n"
2. Search for the authority you just created
3. Observe a warning has been logged

"substr outside of string"

4. Apply patch
5. Refresh the search results from step 2
6. Observe no warnings have been logged

Signed-off-by: Harrison Hawkins <harrisonhawkins@catalyst.net.nz>
Comment 6 Katrin Fischer 2026-01-21 21:35:30 UTC
Quick! Back to this one....
Comment 7 Katrin Fischer 2026-01-21 21:38:15 UTC
Created attachment 191842 [details] [review]
Bug 35423: Fix substr outside of string warning

To test:

Before applying patch

1. Create an authority record, fill field 400$w with "n"
2. Search for the authority you just created
3. Observe a warning has been logged

"substr outside of string"

4. Apply patch
5. Refresh the search results from step 2
6. Observe no warnings have been logged

Signed-off-by: Harrison Hawkins <harrisonhawkins@catalyst.net.nz>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 8 Lucas Gass (lukeg) 2026-01-23 14:30:05 UTC
Nice work everyone!

Pushed to main for 26.05