Bug 20422 - Fix warn on URI/Escape.pm line 184 from opac-detail
Summary: Fix warn on URI/Escape.pm line 184 from opac-detail
Status: RESOLVED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Templates (show other bugs)
Version: master
Hardware: All All
: P5 - low minor (vote)
Assignee: Marcel de Rooy
QA Contact: Testopia
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-03-15 13:12 UTC by Marcel de Rooy
Modified: 2018-06-04 20:15 UTC (History)
0 users

See Also:
Change sponsored?: ---
Patch complexity: Small patch
Bot Control: ---
When did the bot last check this:
Who signed the patch off:
Text to go in the release notes:


Attachments
Bug 20422: Add unit test to Output.t for parametrized_url (1.57 KB, patch)
2018-03-15 13:35 UTC, Marcel de Rooy
Details | Diff | Splinter Review
Bug 20422: Fix warning on uri_escape_utf8 in Output.pm (2.11 KB, patch)
2018-03-15 13:35 UTC, Marcel de Rooy
Details | Diff | Splinter Review
Bug 20422: Add unit test to Output.t for parametrized_url (1.60 KB, patch)
2018-03-15 13:47 UTC, Brendan Gallagher
Details | Diff | Splinter Review
Bug 20422: Fix warning on uri_escape_utf8 in Output.pm (2.13 KB, patch)
2018-03-15 13:47 UTC, Brendan Gallagher
Details | Diff | Splinter Review
Bug 20422: Add unit test to Output.t for parametrized_url (1.65 KB, patch)
2018-03-23 17:11 UTC, Nick Clemens
Details | Diff | Splinter Review
Bug 20422: Fix warning on uri_escape_utf8 in Output.pm (2.19 KB, patch)
2018-03-23 17:11 UTC, Nick Clemens
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Marcel de Rooy 2018-03-15 13:12:09 UTC

    
Comment 1 Marcel de Rooy 2018-03-15 13:35:38 UTC
Created attachment 72952 [details] [review]
Bug 20422: Add unit test to Output.t for parametrized_url

This test will reveal that we need to resolve a warning too.

Test plan:
[1] Run t/Output.t without the second patch.
[2] The test will fail on the warning raised by an undefined value.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 2 Marcel de Rooy 2018-03-15 13:35:43 UTC
Created attachment 72953 [details] [review]
Bug 20422: Fix warning on uri_escape_utf8 in Output.pm

When opac-details calls parametrized_url, it triggers an uninitialized
warning when you would have a record without e.g. author, like:
    Use of uninitialized value in subroutine entry at /usr/share/perl5/URI/Escape.pm line 184.

This is (imo) actually a bug in URI::Escape; it should check its args.
But we resolve the warning here by adding the "// q{}" in parametrized_url.

NOTE: Along the way we do something similar in the arrParamsBusc loop.
If the variable is undefined, jump to the next one. (Consistent with the
approach in the if-part preceding it.)

Test plan:
[1] Run t/Output.t again. Should pass now.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 3 Brendan Gallagher 2018-03-15 13:47:05 UTC
Created attachment 72954 [details] [review]
Bug 20422: Add unit test to Output.t for parametrized_url

This test will reveal that we need to resolve a warning too.

Test plan:
[1] Run t/Output.t without the second patch.
[2] The test will fail on the warning raised by an undefined value.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
Comment 4 Brendan Gallagher 2018-03-15 13:47:30 UTC
Created attachment 72955 [details] [review]
Bug 20422: Fix warning on uri_escape_utf8 in Output.pm

When opac-details calls parametrized_url, it triggers an uninitialized
warning when you would have a record without e.g. author, like:
    Use of uninitialized value in subroutine entry at /usr/share/perl5/URI/Escape.pm line 184.

This is (imo) actually a bug in URI::Escape; it should check its args.
But we resolve the warning here by adding the "// q{}" in parametrized_url.

NOTE: Along the way we do something similar in the arrParamsBusc loop.
If the variable is undefined, jump to the next one. (Consistent with the
approach in the if-part preceding it.)

Test plan:
[1] Run t/Output.t again. Should pass now.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
Comment 5 Nick Clemens 2018-03-23 17:11:22 UTC
Created attachment 73210 [details] [review]
Bug 20422: Add unit test to Output.t for parametrized_url

This test will reveal that we need to resolve a warning too.

Test plan:
[1] Run t/Output.t without the second patch.
[2] The test will fail on the warning raised by an undefined value.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 6 Nick Clemens 2018-03-23 17:11:24 UTC
Created attachment 73211 [details] [review]
Bug 20422: Fix warning on uri_escape_utf8 in Output.pm

When opac-details calls parametrized_url, it triggers an uninitialized
warning when you would have a record without e.g. author, like:
    Use of uninitialized value in subroutine entry at /usr/share/perl5/URI/Escape.pm line 184.

This is (imo) actually a bug in URI::Escape; it should check its args.
But we resolve the warning here by adding the "// q{}" in parametrized_url.

NOTE: Along the way we do something similar in the arrParamsBusc loop.
If the variable is undefined, jump to the next one. (Consistent with the
approach in the if-part preceding it.)

Test plan:
[1] Run t/Output.t again. Should pass now.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 7 Jonathan Druart 2018-03-26 20:38:40 UTC
Pushed to master for 18.05, thanks to everybody involved!