From a754d897cf38bdc317d908695a90e0703e1ccde8 Mon Sep 17 00:00:00 2001 From: Clemens Schwaighofer Date: Wed, 22 Jun 2022 16:17:16 +0900 Subject: [PATCH] Bug fixes for emptynull type in ArrayIO, Form\Generate interval Form\Generate for intervals also allows day(s), month(s), year(s), call case insensitive ArrayIO fix for missing escale literal for date/datetime/interval/emptynull text type --- www/lib/CoreLibs/DB/Extended/ArrayIO.php | 2 +- www/lib/CoreLibs/Output/Form/Generate.php | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/www/lib/CoreLibs/DB/Extended/ArrayIO.php b/www/lib/CoreLibs/DB/Extended/ArrayIO.php index 8e49914c..3384c747 100644 --- a/www/lib/CoreLibs/DB/Extended/ArrayIO.php +++ b/www/lib/CoreLibs/DB/Extended/ArrayIO.php @@ -471,7 +471,7 @@ class ArrayIO extends \CoreLibs\DB\IO ) { $_value = 'NULL'; } elseif (isset($this->table_array[$column]['value'])) { - $_value = $this->table_array[$column]['value']; + $_value = $this->dbEscapeLiteral($this->table_array[$column]['value']); } else { // fallback $_value = 'NULL'; diff --git a/www/lib/CoreLibs/Output/Form/Generate.php b/www/lib/CoreLibs/Output/Form/Generate.php index e2dbd413..1c850891 100644 --- a/www/lib/CoreLibs/Output/Form/Generate.php +++ b/www/lib/CoreLibs/Output/Form/Generate.php @@ -1198,7 +1198,12 @@ class Generate extends \CoreLibs\DB\Extended\ArrayIO } break; case 'intervalshort': // ony interval n [Y/M/D] only - if (preg_match("/^\d{1,3}\ ?[YMDymd]{1}$/", $this->table_array[$key]['value'])) { + if ( + !preg_match( + "/^\d{1,3}\ ?([ymd]{1}|day(s)?|year(s)?|month(s)?)$/i", + $this->table_array[$key]['value'] + ) + ) { $this->msg .= sprintf( $this->l->__( 'Please enter a valid time interval in the format '