Bug 31535 - Fix a staff warn or two
Summary: Fix a staff warn or two
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Architecture, internals, and plumbing (show other bugs)
Version: Main
Hardware: All All
: P5 - low trivial (vote)
Assignee: Marcel de Rooy
QA Contact: Joonas Kylmälä
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-09-08 14:04 UTC by Marcel de Rooy
Modified: 2023-12-28 20:42 UTC (History)
1 user (show)

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


Attachments
Bug 31535: Fix warning - uninitialized value $mode in string ne (1.26 KB, patch)
2022-09-08 14:08 UTC, Marcel de Rooy
Details | Diff | Splinter Review
Bug 31535: Fix warning - uninitialized value $mode in string ne (addbiblio.pl) (1.28 KB, patch)
2022-09-09 07:45 UTC, Marcel de Rooy
Details | Diff | Splinter Review
Bug 31535: Fix warning - uninitialized value in string ne (MARCdetail.pl) (1.68 KB, patch)
2022-09-09 07:45 UTC, Marcel de Rooy
Details | Diff | Splinter Review
Bug 31535: Fix warning - uninitialized value for location (1.23 KB, patch)
2022-09-09 07:45 UTC, Marcel de Rooy
Details | Diff | Splinter Review
Bug 31535: Fix warning - uninitialized value $mode in string ne (addbiblio.pl) (1.38 KB, patch)
2022-09-12 15:29 UTC, Joonas Kylmälä
Details | Diff | Splinter Review
Bug 31535: Fix warning - uninitialized value in string ne (MARCdetail.pl) (1.78 KB, patch)
2022-09-12 15:29 UTC, Joonas Kylmälä
Details | Diff | Splinter Review
Bug 31535: Fix warning - uninitialized value for location (1.34 KB, patch)
2022-09-12 15:29 UTC, Joonas Kylmälä
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 2022-09-08 14:04:43 UTC

    
Comment 1 Marcel de Rooy 2022-09-08 14:08:30 UTC Comment hidden (obsolete)
Comment 2 Marcel de Rooy 2022-09-09 07:45:27 UTC
Created attachment 140362 [details] [review]
Bug 31535: Fix warning - uninitialized value $mode in string ne (addbiblio.pl)

Line number varies across versions. (Should be L887 now.)
Resolves:
    Use of uninitialized value $mode in string ne at /usr/share/koha/cataloguing/addbiblio.pl line 845.

No test plan here. This is trivial. Read the patch.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 3 Marcel de Rooy 2022-09-09 07:45:31 UTC
Created attachment 140363 [details] [review]
Bug 31535: Fix warning - uninitialized value in string ne (MARCdetail.pl)

Spotted at line 183 (older Koha version).

Test plan:
You need a NULL in the tab column of marc_subfield_structure. Hit this
page and check the logs.
This might convince you easier:
  my $tabloop=0; my $x; print "Empty string - True\n" if ( $x // q{} ) ne $tabloop;
  print "Zero - True\n" if ( $x // '0' ) ne $tabloop;
You should only see: Empty string - True proving that defaulting to '0'
would be a game changer.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 4 Marcel de Rooy 2022-09-09 07:45:34 UTC
Created attachment 140364 [details] [review]
Bug 31535: Fix warning - uninitialized value for location

In Koha/Item.pm line 169 (line number has been changed)

Test plan:
You need location to be NULL when storing.
Otherwise follow this reasoning:
  What happens when location is undefined? It is autovivified to
  empty string in the string compare (ne), so not equal to CART
  and PROC. The subcondition is true before and after this patch.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 5 Marcel de Rooy 2022-09-09 07:47:15 UTC
Fairly trivial, architectural stuff. Self SO
Comment 6 Joonas Kylmälä 2022-09-12 15:29:11 UTC
Created attachment 140463 [details] [review]
Bug 31535: Fix warning - uninitialized value $mode in string ne (addbiblio.pl)

Line number varies across versions. (Should be L887 now.)
Resolves:
    Use of uninitialized value $mode in string ne at /usr/share/koha/cataloguing/addbiblio.pl line 845.

No test plan here. This is trivial. Read the patch.

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

Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Comment 7 Joonas Kylmälä 2022-09-12 15:29:15 UTC
Created attachment 140464 [details] [review]
Bug 31535: Fix warning - uninitialized value in string ne (MARCdetail.pl)

Spotted at line 183 (older Koha version).

Test plan:
You need a NULL in the tab column of marc_subfield_structure. Hit this
page and check the logs.
This might convince you easier:
  my $tabloop=0; my $x; print "Empty string - True\n" if ( $x // q{} ) ne $tabloop;
  print "Zero - True\n" if ( $x // '0' ) ne $tabloop;
You should only see: Empty string - True proving that defaulting to '0'
would be a game changer.

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

Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Comment 8 Joonas Kylmälä 2022-09-12 15:29:19 UTC
Created attachment 140465 [details] [review]
Bug 31535: Fix warning - uninitialized value for location

In Koha/Item.pm line 169 (line number has been changed)

Test plan:
You need location to be NULL when storing.
Otherwise follow this reasoning:
  What happens when location is undefined? It is autovivified to
  empty string in the string compare (ne), so not equal to CART
  and PROC. The subcondition is true before and after this patch.

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

Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Comment 9 Tomás Cohen Arazi 2022-09-12 19:42:40 UTC
Pushed to master for 22.11.

Nice work everyone, thanks!