Bug 36791 - Koha explodes when trying to edit an authority record with an invalid authid
Summary: Koha explodes when trying to edit an authority record with an invalid authid
Status: Pushed to oldstable
Alias: None
Product: Koha
Classification: Unclassified
Component: MARC Authority data support (show other bugs)
Version: unspecified
Hardware: All All
: P5 - low normal (vote)
Assignee: Janusz Kaczmarek
QA Contact: Emily Lamancusa
URL:
Keywords:
Depends on:
Blocks: 36832
  Show dependency treegraph
 
Reported: 2024-05-06 11:19 UTC by Janusz Kaczmarek
Modified: 2024-05-23 14:16 UTC (History)
3 users (show)

See Also:
Change sponsored?: Sponsored
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
24.05.00,23.11.06,23.05.12


Attachments
Bug 36791: Koha explodes when trying to edit an authority rec. with an invalid authid (1.96 KB, patch)
2024-05-06 11:54 UTC, Janusz Kaczmarek
Details | Diff | Splinter Review
Bug 36791: Koha explodes when trying to edit an authority rec. with an invalid authid (2.02 KB, patch)
2024-05-06 15:51 UTC, Roman Dolny
Details | Diff | Splinter Review
Bug 36791: Koha explodes when trying to edit an authority rec. with an invalid authid (2.09 KB, patch)
2024-05-09 15:34 UTC, Emily Lamancusa
Details | Diff | Splinter Review
Bug 36791: (QA follow-up) Simplify conditional (908 bytes, patch)
2024-05-09 15:34 UTC, Emily Lamancusa
Details | Diff | Splinter Review
Bug 36832: (bug 36791 follow-up) Allow authid=0 (1.01 KB, patch)
2024-05-10 18:08 UTC, Emily Lamancusa
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Janusz Kaczmarek 2024-05-06 11:19:04 UTC
When trying to open the authority editor with authid=<invalid_authid> (e.g. a deleted authid) Koha explodes with a message: << Can't call method "authtypecode" on an undefined value at /kohadevbox/koha/authorities/authorities.pl line 556 >>
Comment 1 Janusz Kaczmarek 2024-05-06 11:54:30 UTC
Created attachment 166214 [details] [review]
Bug 36791: Koha explodes when trying to edit an authority rec. with an invalid authid

When trying to open the authority editor with authid=<invalid_authid>
(e.g. a deleted authid) Koha explodes with a message:
Can't call method "authtypecode" on an undefined value at
/kohadevbox/koha/authorities/authorities.pl line 556

This this because authtypecode method is called on the result of
->find without verifying that it was succesful.

Test plan:
==========
1. Try to edit an auth rec. giving as a authid (in URL) a non-existing
   authid, e.g. in ktd, with standard ktd test data:
   http://your_ktd:8081/cgi-bin/koha/authorities/authorities.pl?authid=100000
   Koha should explode with the message:
   Can't call method "authtypecode" on an undefined value at
   /kohadevbox/koha/authorities/authorities.pl line 556
2. Apply the patch; restart_all.
3. Repeat p. 1.  You should get the 404 error page.

Sponsored-by: Ignatianum University in Cracow
Comment 2 Roman Dolny 2024-05-06 15:51:19 UTC
Created attachment 166234 [details] [review]
Bug 36791: Koha explodes when trying to edit an authority rec. with an invalid authid

When trying to open the authority editor with authid=<invalid_authid>
(e.g. a deleted authid) Koha explodes with a message:
Can't call method "authtypecode" on an undefined value at
/kohadevbox/koha/authorities/authorities.pl line 556

This this because authtypecode method is called on the result of
->find without verifying that it was succesful.

Test plan:
==========
1. Try to edit an auth rec. giving as a authid (in URL) a non-existing
   authid, e.g. in ktd, with standard ktd test data:
   http://your_ktd:8081/cgi-bin/koha/authorities/authorities.pl?authid=100000
   Koha should explode with the message:
   Can't call method "authtypecode" on an undefined value at
   /kohadevbox/koha/authorities/authorities.pl line 556
2. Apply the patch; restart_all.
3. Repeat p. 1.  You should get the 404 error page.

Sponsored-by: Ignatianum University in Cracow
Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl>
Comment 3 Emily Lamancusa 2024-05-09 15:34:56 UTC
Created attachment 166465 [details] [review]
Bug 36791: Koha explodes when trying to edit an authority rec. with an invalid authid

When trying to open the authority editor with authid=<invalid_authid>
(e.g. a deleted authid) Koha explodes with a message:
Can't call method "authtypecode" on an undefined value at
/kohadevbox/koha/authorities/authorities.pl line 556

This this because authtypecode method is called on the result of
->find without verifying that it was succesful.

Test plan:
==========
1. Try to edit an auth rec. giving as a authid (in URL) a non-existing
   authid, e.g. in ktd, with standard ktd test data:
   http://your_ktd:8081/cgi-bin/koha/authorities/authorities.pl?authid=100000
   Koha should explode with the message:
   Can't call method "authtypecode" on an undefined value at
   /kohadevbox/koha/authorities/authorities.pl line 556
2. Apply the patch; restart_all.
3. Repeat p. 1.  You should get the 404 error page.

Sponsored-by: Ignatianum University in Cracow
Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl>
Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Comment 4 Emily Lamancusa 2024-05-09 15:34:59 UTC
Created attachment 166466 [details] [review]
Bug 36791: (QA follow-up) Simplify conditional

Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Comment 5 Emily Lamancusa 2024-05-09 15:36:34 UTC
Nice catch! Passing QA
Comment 6 Katrin Fischer 2024-05-10 12:13:19 UTC
Pushed for 24.05!

Well done everyone, thank you!
Comment 7 Emily Lamancusa 2024-05-10 18:08:19 UTC Comment hidden (obsolete)
Comment 8 Fridolin Somers 2024-05-22 12:49:23 UTC
Pushed to 23.11.x for 23.11.06
Comment 9 Lucas Gass 2024-05-23 14:16:07 UTC
Backported to 23.05.x for upcoming 23.05.12