Bug 34432 - Koha::Email->is_valid could be more strict
Summary: Koha::Email->is_valid could be more strict
Status: NEW
Alias: None
Product: Koha
Classification: Unclassified
Component: Architecture, internals, and plumbing (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Bugs List
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-07-27 12:58 UTC by Marcel de Rooy
Modified: 2023-07-27 12:58 UTC (History)
0 users

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Marcel de Rooy 2023-07-27 12:58:48 UTC
We are using Email::Address->parse there. Which returns a list of Email::Address objects for all email addresses found.
And if we receive something (altough changed), we return true.
But we generally just want to validate one address?

So this is all fine for Koha::Email:
    Koha::Email->is_valid('test1@a.nl  '),
    Koha::Email->is_valid('  test1@a.nl'),
    Koha::Email->is_valid('test1@a.nl,test2@b.nl'),

Note that the returned addresses are trimmed (and ignored).

This may not be a big deal for the interface btw, since we have HTML5 validation on email fields.
But could be a problem when coming from eg REST API and validation is just done with is_valid.