Bugzilla – Attachment 119144 Details for
Bug 27746
Use of uninitialized value $oclc in pattern match (m//) error at C4/Koha.pm
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 27746: prevent regexp undefined warning when checking subfield contents ($oclc)
Bug-27746-prevent-regexp-undefined-warning-when-ch.patch (text/plain), 1.53 KB, created by
David Nind
on 2021-04-02 19:58:58 UTC
(
hide
)
Description:
Bug 27746: prevent regexp undefined warning when checking subfield contents ($oclc)
Filename:
MIME Type:
Creator:
David Nind
Created:
2021-04-02 19:58:58 UTC
Size:
1.53 KB
patch
obsolete
>From a0527ea3e5476d397d2e2c37e1d43b64e17e5653 Mon Sep 17 00:00:00 2001 >From: Petro Vashchuk <stalkernoid@gmail.com> >Date: Mon, 22 Feb 2021 13:46:44 +0200 >Subject: [PATCH] Bug 27746: prevent regexp undefined warning when checking > subfield contents ($oclc) > >Some of the books have subfield "a" of field "035" absent >and it's possible to have such >(it doesn't says "Require" in the interface), >which causes "Use of uninitialized value $oclc in pattern match (m//)" >error. > >Solved by screening regex with check for empty variables before the >match. > >To reproduce: > 1) Edit existing book or create a new one with empty marc >subfield "a" of field "035" > 2) Use the search feature that will find it along with some other >books. > 3) Check /var/log/koha/kohadev/plack-intranet-error.log to find >"Use of uninitialized value $oclc in pattern match (m//)" error. > 4) Apply the patch. > 5) Repeat the search and check the logs again to ensure >that error didn't appear again. > >Signed-off-by: David Nind <david@davidnind.com> >--- > C4/Koha.pm | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > >diff --git a/C4/Koha.pm b/C4/Koha.pm >index aac05c76f9..c08ee6ad44 100644 >--- a/C4/Koha.pm >+++ b/C4/Koha.pm >@@ -671,7 +671,7 @@ sub GetNormalizedOCLCNumber { > my @fields = $marcrecord->field('035'); > foreach my $field (@fields) { > my $oclc = $field->subfield('a'); >- if ($oclc =~ /OCoLC/) { >+ if ($oclc && $oclc =~ /OCoLC/) { > $oclc =~ s/\(OCoLC\)//; > return $oclc; > } >-- >2.11.0
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 27746
:
117139
|
119144
|
119555