Bug 28699

Summary: Noisy warns in checkauth when patron has no firstname
Product: Koha Reporter: Nick Clemens <nick>
Component: Architecture, internals, and plumbingAssignee: Nick Clemens <nick>
Status: RESOLVED DUPLICATE QA Contact: Marcel de Rooy <m.de.rooy>
Severity: normal    
Priority: P5 - low CC: david, dcook, jonathan.druart, m.de.rooy
Version: Main   
Hardware: All   
OS: All   
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:
Attachments: Bug 28699: Allow for blank firstname in checkauth
Bug 28699: Allow for blank firstname in checkauth
Bug 28699: Allow for blank firstname in checkauth

Description Nick Clemens 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 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 ***