Bug 28699 - Noisy warns in checkauth when patron has no firstname
Summary: Noisy warns in checkauth when patron has no firstname
Status: RESOLVED DUPLICATE of bug 28606
Alias: None
Product: Koha
Classification: Unclassified
Component: Architecture, internals, and plumbing (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal
Assignee: Nick Clemens (kidclamp)
QA Contact: Marcel de Rooy
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-07-09 13:26 UTC by Nick Clemens (kidclamp)
Modified: 2021-07-16 13:13 UTC (History)
4 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
This removes unnecessary warning messages in plack-opac-error.log when patrons have no first name.
Version(s) released in:
Circulation function:


Attachments
Bug 28699: Allow for blank firstname in checkauth (1.51 KB, patch)
2021-07-09 13:28 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 28699: Allow for blank firstname in checkauth (1.56 KB, patch)
2021-07-09 22:24 UTC, David Nind
Details | Diff | Splinter Review
Bug 28699: Allow for blank firstname in checkauth (1.72 KB, patch)
2021-07-16 06:25 UTC, Marcel de Rooy
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Nick Clemens (kidclamp) 2021-07-09 13:26:05 UTC
Firstname field is not required, however, we try to log it in checkauth:
 888             Koha::Logger->get->debug(sprintf "AUTH_SESSION: (%s)\t%s %s - %s", map { $session->param($_) || "" } qw(cardnumber firstname surname branch));

This causes a warn in the logs:
[2021/07/09 13:22:54] [WARN] Use of uninitialized value in sprintf at /kohadevbox/koha/C4/Auth.pm line 888.

To recreate:
1 - Remove first name from a patron
2 - tail -f /var/log/koha/kohadev/plack-opac-error.log
3 - Login as that patron on the opac
Comment 1 Nick Clemens (kidclamp) 2021-07-09 13:28:38 UTC
Created attachment 122745 [details] [review]
Bug 28699: Allow for blank firstname in checkauth

When mapping the fields from the session we should map blank fieds
to blank strings

To test:
1 - Remove first name from a patron
2 - tail -f /var/log/koha/kohadev/plack-opac-error.log
3 - Login as that patron on the opac
4 - Note warns in the log like:
    [2021/07/09 13:22:54] [WARN] Use of uninitialized value in sprintf at /kohadevbox/koha/C4/Auth.pm line 888.
5 - Apply patch
6 - restart_all
7 - Log out and in to opac with user
8 - Note warns above are gone
Comment 2 David Nind 2021-07-09 22:24:10 UTC
Created attachment 122758 [details] [review]
Bug 28699: Allow for blank firstname in checkauth

When mapping the fields from the session we should map blank fieds
to blank strings

To test:
1 - Remove first name from a patron
2 - tail -f /var/log/koha/kohadev/plack-opac-error.log
3 - Login as that patron on the opac
4 - Note warns in the log like:
    [2021/07/09 13:22:54] [WARN] Use of uninitialized value in sprintf at /kohadevbox/koha/C4/Auth.pm line 888.
5 - Apply patch
6 - restart_all
7 - Log out and in to opac with user
8 - Note warns above are gone

Signed-off-by: David Nind <david@davidnind.com>
Comment 3 David Cook 2021-07-12 01:41:36 UTC
Thank you, Nick. This has been bugging me for ages. I'll make a note to QA this later today. (I am half-tempted to pass it just because it's so simple, but I had better give at least one spin through...)
Comment 4 Marcel de Rooy 2021-07-16 06:25:42 UTC
Created attachment 122865 [details] [review]
Bug 28699: Allow for blank firstname in checkauth

When mapping the fields from the session we should map blank fieds
to blank strings

To test:
1 - Remove first name from a patron
2 - tail -f /var/log/koha/kohadev/plack-opac-error.log
3 - Login as that patron on the opac
4 - Note warns in the log like:
    [2021/07/09 13:22:54] [WARN] Use of uninitialized value in sprintf at /kohadevbox/koha/C4/Auth.pm line 888.
5 - Apply patch
6 - restart_all
7 - Log out and in to opac with user
8 - Note warns above are gone

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
[EDIT] Replaced || by //, since we talk here about uninitialized.
Comment 5 Jonathan Druart 2021-07-16 13:13:33 UTC
I fixed that earlier this week with a follow-up on bug 28606
  commit af7e41d1142573666d302a8475274ea58e5c99f4
  Bug 28606: Remove warning from C4::Auth 887

*** This bug has been marked as a duplicate of bug 28606 ***