If userenv->{flags} is undefined, the modulus 2 generates floody entries.
Created attachment 24587 [details] [review] Bug 11587 - IsSuperLibrarian generates warnings This corrects line 1250 of C4/Context.pm to be: return ($userenv->{flags}//0) % 2; And thus avoids an uninitialized value used in the modulus. TEST PLAN --------- 1) Apply the first patch (to update t/Context.t) 2) prove -v t/Context.t -- This should fail tests 7 and 8 3) Apply this patch (to fix C4/Context.pm) 4) prove -v t/Context.t -- All tests should succeed
Created attachment 24588 [details] [review] Bug 11587 - IsSuperLibrarian generates warnings Simply viewing OPAC detail triggers a modulus warning entry. This first patch adds two test cases to t/Context.t to test for this situation. TEST PLAN --------- 1) Apply this patch (to upgrade t/Context.t) 2) prove -v t/Context.t -- Tests 7 and 8 will fail 3) Apply second patch (to amend C4/Context.pm) 4) prove -v t/Context.t -- All tests will succeed
Created attachment 24589 [details] [review] Bug 11587 - IsSuperLibrarian generates warnings This corrects line 1250 of C4/Context.pm to be: return ($userenv->{flags}//0) % 2; And thus avoids an uninitialized value used in the modulus. TEST PLAN --------- 1) Apply the first patch (to update t/Context.t) 2) prove -v t/Context.t -- This should fail tests 7 and 8 3) Apply this patch (to fix C4/Context.pm) 4) prove -v t/Context.t -- All tests should succeed
Silly default of enhancement! DOH!
Created attachment 24666 [details] [review] Bug 11587 - IsSuperLibrarian generates warnings Simply viewing OPAC detail triggers a modulus warning entry. This first patch adds two test cases to t/Context.t to test for this situation. TEST PLAN --------- 1) Apply this patch (to upgrade t/Context.t) 2) prove -v t/Context.t -- Tests 7 and 8 will fail 3) Apply second patch (to amend C4/Context.pm) 4) prove -v t/Context.t -- All tests will succeed Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Created attachment 24667 [details] [review] Bug 11587 - IsSuperLibrarian generates warnings This corrects line 1250 of C4/Context.pm to be: return ($userenv->{flags}//0) % 2; And thus avoids an uninitialized value used in the modulus. TEST PLAN --------- 1) Apply the first patch (to update t/Context.t) 2) prove -v t/Context.t -- This should fail tests 7 and 8 3) Apply this patch (to fix C4/Context.pm) 4) prove -v t/Context.t -- All tests should succeed Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Created attachment 24676 [details] [review] Bug 11587 - IsSuperLibrarian generates warnings (UT) Simply viewing OPAC detail triggers a modulus warning entry. This first patch adds two test cases to t/Context.t to test for this situation. TEST PLAN --------- 1) Apply this patch (to upgrade t/Context.t) 2) prove -v t/Context.t -- Tests 7 and 8 will fail 3) Apply second patch (to amend C4/Context.pm) 4) prove -v t/Context.t -- All tests will succeed Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz> Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Created attachment 24677 [details] [review] Bug 11587 - IsSuperLibrarian generates warnings This corrects line 1250 of C4/Context.pm to be: return ($userenv->{flags}//0) % 2; And thus avoids an uninitialized value used in the modulus. TEST PLAN --------- 1) Apply the first patch (to update t/Context.t) 2) prove -v t/Context.t -- This should fail tests 7 and 8 3) Apply this patch (to fix C4/Context.pm) 4) prove -v t/Context.t -- All tests should succeed Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz> Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Created attachment 24678 [details] [review] Bug 11587 - Add UT for IsSuperLibrarian if flags == 0 Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
*** Bug 11893 has been marked as a duplicate of this bug. ***
Pushed to master. Thanks, Mark!
Pushed to 3.14.x, will be in 3.14.10 I decided in the end to integrate Bug 10277 so also this one.