Bug 24538: Handle Net::Netmask parser errors
authorDavid Cook <dcook@prosentient.com.au>
Wed, 19 Feb 2020 02:07:30 +0000 (02:07 +0000)
committerJoy Nelson <joy@bywatersolutions.com>
Fri, 13 Mar 2020 00:57:33 +0000 (00:57 +0000)
commit382372edbb9082616d53231d2c18ce82f081e0f7
treeacfd40a276c492f9e5ec88bcbb33d4bceab72102
parent44f733ee63cd5bcb18d21e7811907fe4de027e46
Bug 24538: Handle Net::Netmask parser errors

This patch switches from the new() to new2() constructor,
which will return an undef value when it fails to parse a value.

This patch warns on parser failures, but otherwise silently drops
the invalid value, and returns objects for any valid input it can parse.
This way one mistake won't disable the whole feature.

To test:
1. Run the unit test t/Koha/Middlware/RealIP.t

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Joy Nelson <joy@bywatersolutions.com>
Koha/Middleware/RealIP.pm