Bugzilla – Attachment 53120 Details for
Bug 16848
Wrong warning "Invalid date ... passed to output_pref" can be carped
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[SIGNED-OFF] Bug 16848: Prevent invalid warning to be carped from output_pref
Bug-16848-Prevent-invalid-warning-to-be-carped-fro.patch (text/plain), 1.62 KB, created by
Srdjan Jankovic
on 2016-07-06 02:51:37 UTC
(
hide
)
Description:
[SIGNED-OFF] Bug 16848: Prevent invalid warning to be carped from output_pref
Filename:
MIME Type:
Creator:
Srdjan Jankovic
Created:
2016-07-06 02:51:37 UTC
Size:
1.62 KB
patch
obsolete
>From 49b54bd5912e8703719db92a029a842d8d81a719 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Mon, 4 Jul 2016 11:53:39 +0100 >Subject: [PATCH] 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@catalyst.net.nz> >--- > Koha/DateUtils.pm | 7 +++++-- > 1 file changed, 5 insertions(+), 2 deletions(-) > >diff --git a/Koha/DateUtils.pm b/Koha/DateUtils.pm >index 6207cc1..51d3d93 100644 >--- a/Koha/DateUtils.pm >+++ b/Koha/DateUtils.pm >@@ -213,8 +213,11 @@ sub output_pref { > and return > if $dt and $str; > >- $dt = eval { dt_from_string( $str ) } if $str; >- carp "Invalid date '$str' passed to output_pref\n" if $@; >+ if ( $str ) { >+ local $@; >+ $dt = eval { dt_from_string( $str ) }; >+ carp "Invalid date '$str' passed to output_pref\n" if $@; >+ } > > return unless defined $dt; > >-- >2.7.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 16848
:
53090
|
53120
|
54121