[Koha-bugs] [Bug 22001] RaiseError and PrintError flags must be set for tests

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Tue Mar 31 16:07:50 CEST 2020


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

--- Comment #19 from Jonathan Druart <jonathan.druart at bugs.koha-community.org> ---
Created attachment 102140
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=102140&action=edit
Bug 22001: Set unsafe only if RaiseError is not set

Sooooo....

That was tricky, and the solution looks trivial.
However it's not.
We have unsafe set for "historical reason".
Having it on when RaiseError is on have the effect of overwritting the
DBIC error handler.

The problem is:
t/db_dependent/Circulation/MarkIssueReturned.t (and other tests) is failing
with:

  # expecting: Koha::Exceptions::Object::BadValue
  # found: DBIx::Class::Exception ({UNKNOWN}: Can't locate object method
"rethrow" via package "DBD::mysql::st execute failed: Incorrect datetime value:
'bad_date' for column 'returndate' at row 1 [for Statement "UPDATE `issues` SET
`returndate` = ? WHERE ( `issue_id` = ? )" with ParamValues: 0='bad_date',
1=238] at /usr/share/perl5/DBIx/Class/Storage/DBI.pm line

In Koha::Object->store, the exception is not a DBIx::Class::Exception object
(as we except), but
a string (on which we cannot call rethrow).

Swithing unsafe off restores the expected behavior.
To make sure the UI will not be affected, it is only turned off when
RaiseError is set.

The situation is still wrong (for UI), from the POD
https://metacpan.org/pod/DBIx::Class::Storage::DBI (/unsafe)
"""
Note that your custom settings can cause Storage to malfunction, especially if
you set a HandleError handler that suppresses exceptions and/or disable
RaiseError.
"""

And also
https://metacpan.org/release/DBIx-Class/source/lib/DBIx/Class/Storage/DBI.pm#L1531

Many thanks Tomas for the digging exploration!

We need to turn RaiseError and remove the unsafe flag, for UI as well,
but that should be done at the beginning of a dev cycle.

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


More information about the Koha-bugs mailing list