]> git.koha-community.org Git - koha.git/commit
Bug 27746: prevent regexp undefined warning when checking subfield contents ($oclc)
authorPetro Vashchuk <stalkernoid@gmail.com>
Mon, 22 Feb 2021 11:46:44 +0000 (13:46 +0200)
committerFridolin Somers <fridolin.somers@biblibre.com>
Mon, 19 Apr 2021 12:55:45 +0000 (14:55 +0200)
commit4f618fb33a80d7f757dc0c95832b6d6c7d71f819
tree481bbda5e4b9f606cc4ffbc82fb9ff0ba1c1d2aa
parentb69b0ac61d0a23480ae9d05b6652d2cb71670829
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>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit a34e1f9f0d32e4cf0f282016e52166d309b25ef7)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
C4/Koha.pm