Bug 23825: Koha/Object.t might fail on a backtick
authorMarcel de Rooy <m.de.rooy@rijksmuseum.nl>
Fri, 18 Oct 2019 09:31:10 +0000 (09:31 +0000)
committerVictor Grousset/tuxayo <victor@tuxayo.net>
Mon, 22 Jun 2020 23:12:58 +0000 (01:12 +0200)
commit9a1f3e79ff07f45ddc98d36ed73722206705a94e
tree52da4a7308f3db6d6fd7e646b6bcab900418c755
parent62eb5e6e34bdc8f91b6ca39405e716e8cb041f8f
Bug 23825: Koha/Object.t might fail on a backtick

If the SQL error message contains a backtick instead of a regular quote,
the regex for throwing an exception did not work.
Example:
Incorrect datetime value: 'wrong_value' for column `koha_master`.`borrowers`.`lastseen`
Note the backtics where the regex contains a regular quote.

This patch makes it more flexible: it allows one \W character before the
column name, even optional.

Test plan:
Run Koha/Object.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

(cherry picked from commit 480afea9ddf642fbd6ec499172e5ef6400905424)
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Koha/Object.pm