[Koha-bugs] [Bug 30196] Odd number of elements warning caused by dt_from_string

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Mon Jun 27 19:33:40 CEST 2022


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

Shi Yao Wang <shi-yao.wang at inLibro.com> changed:

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

--- Comment #5 from Shi Yao Wang <shi-yao.wang at inLibro.com> ---
Created attachment 136656
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=136656&action=edit
Bug 30196: Odd number of elements warning caused by dt_from_string

Koha/DateUtils' dt_from_string is a sub expected to return a scalar, but
does not in all case.

In one instance, tt simply return... nothing, which cause one common call
output_pref( { dt => dt_from_string( $serinfo->{$d} ), dateonly => 1 } );
to output a warning.

Simply returning undef instead will solve the issue.

Test plan:
1- Have a terminal tail intranet error logs
2- In the code, go to about.pl and change the only dt_from_string() to
dt_from_string('0000-00-00')
3- Go to About Koha
4- Notice the logs output is: "Odd number of elements in anonymous hash at ..."
and error 500 on the page.
5- Apply the patch
6- Redo step 3 and notice the previous log output is not there and the page
loads
7- run `prove t/DateUtils.t` and all tests should pass

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


More information about the Koha-bugs mailing list