Bugzilla – Attachment 102140 Details for
Bug 22001
Add RaiseError and PrintError flags for all tests
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 22001: Set unsafe only if RaiseError is not set
Bug-22001-Set-unsafe-only-if-RaiseError-is-not-set.patch (text/plain), 2.28 KB, created by
Jonathan Druart
on 2020-03-31 14:07:50 UTC
(
hide
)
Description:
Bug 22001: Set unsafe only if RaiseError is not set
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2020-03-31 14:07:50 UTC
Size:
2.28 KB
patch
obsolete
>From 2592dc40befa3bd329edcc32ed71c5fc3754a426 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 31 Mar 2020 15:58:21 +0200 >Subject: [PATCH] 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. >--- > Koha/Database.pm | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > >diff --git a/Koha/Database.pm b/Koha/Database.pm >index 6d8a1e2556..55baf80537 100644 >--- a/Koha/Database.pm >+++ b/Koha/Database.pm >@@ -103,7 +103,7 @@ sub _new_schema { > %encoding_attr, > RaiseError => $RaiseError, > PrintError => 1, >- unsafe => 1, >+ unsafe => !$RaiseError, > quote_names => 1, > on_connect_do => [ > $encoding_query || (), >-- >2.20.1
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 22001
:
83230
|
83231
|
83232
|
98910
|
98911
|
98912
|
99589
|
99590
|
99591
|
101989
|
101990
|
101991
|
102070
| 102140 |
102147
|
102149
|
102150
|
102151
|
102152