Bugzilla – Attachment 166214 Details for
Bug 36791
Koha explodes when trying to edit an authority record with an invalid authid
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 36791: Koha explodes when trying to edit an authority rec. with an invalid authid
Bug-36791-Koha-explodes-when-trying-to-edit-an-aut.patch (text/plain), 1.96 KB, created by
Janusz Kaczmarek
on 2024-05-06 11:54:30 UTC
(
hide
)
Description:
Bug 36791: Koha explodes when trying to edit an authority rec. with an invalid authid
Filename:
MIME Type:
Creator:
Janusz Kaczmarek
Created:
2024-05-06 11:54:30 UTC
Size:
1.96 KB
patch
obsolete
>From de707ab3da4e24e43adfd1aa147cd6ed9ae76dde Mon Sep 17 00:00:00 2001 >From: Janusz Kaczmarek <januszop@gmail.com> >Date: Mon, 6 May 2024 11:44:26 +0000 >Subject: [PATCH] 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 >--- > authorities/authorities.pl | 8 ++++++-- > 1 file changed, 6 insertions(+), 2 deletions(-) > >diff --git a/authorities/authorities.pl b/authorities/authorities.pl >index 462098bc1e..5695782f30 100755 >--- a/authorities/authorities.pl >+++ b/authorities/authorities.pl >@@ -552,11 +552,15 @@ if ( $op eq 'cud-change-framework' ) { > } > > my $dbh = C4::Context->dbh; >+my $authobj = Koha::Authorities->find($authid); >+if ( defined $authid && !$authid || $authid && !$authobj ) { >+ print $input->redirect("/cgi-bin/koha/errors/404.pl"); # escape early >+ exit; >+} > if(!$authtypecode) { >- $authtypecode = $authid ? Koha::Authorities->find($authid)->authtypecode : ''; >+ $authtypecode = $authid ? $authobj->authtypecode : ''; > } > >-my $authobj = Koha::Authorities->find($authid); > my $count = $authobj ? $authobj->get_usage_count : 0; > > my ($template, $loggedinuser, $cookie) >-- >2.39.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 36791
:
166214
|
166234
|
166465
|
166466
|
166591