[Koha-bugs] [Bug 16848] Wrong warning "Invalid date ... passed to output_pref" can be carped

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Sun Aug 7 14:03:12 CEST 2016


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16848

Katrin Fischer <katrin.fischer at bsz-bw.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #53120|0                           |1
        is obsolete|                            |

--- Comment #9 from Katrin Fischer <katrin.fischer at bsz-bw.de> ---
Created attachment 54121
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=54121&action=edit
[PASSED QA] Bug 16848: Prevent invalid warning to be carped from output_pref

>From Koha::DateUtils::output_pref:

   $dt = eval { dt_from_string( $str ) } if $str;
   carp "Invalid date '$str' passed to output_pref\n" if $@;

This second line is wrong: if $str does not exist, the first line is not
evaluated and $@ could be filled with previous error.

To reproduce:

Then:
  prove t/DateUtils.t
will display:
t/DateUtils.t .. 20/60 Use of uninitialized value $str in concatenation (.) or
string at Koha/DateUtils.pm line 217.
Invalid date '' passed to output_pref
 at t/DateUtils.t line 233.
t/DateUtils.t .. ok
All tests successful.
Files=1, Tests=60,  2 wallclock secs ( 0.02 usr  0.00 sys +  1.40 cusr  0.00
csys =  1.42 CPU)
Result: PASS

Test plan:
Without this patch, you should not see the carp

Signed-off-by: Srdjan <srdjan at catalyst.net.nz>

Signed-off-by: Katrin Fischer <katrin.fischer.83 at web.de>

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list