Skip to content

Commit

Permalink
[BUGFIX] Allow empty date/time in strict database modes
Browse files Browse the repository at this point in the history
Empty date/time values are represented by the FormEngine as empty
string (''). Trying to persist this value in database management systems
using strict mode (which is enabled per default in MySQL 5.7),
will cause an SQL error since field types do not match.

Since it's known for the TYPO3 core which field types are used in
particular database tables, it's also possible to enforce this
type to be casted to integer values. This is done by using the
according TCA evaluation function 'int'.

Resolves: #82756
Releases: master, 8.7
Change-Id: I487caae785a3943916bceebc0c484d58e900a841
Reviewed-on: https://review.typo3.org/56062
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Mathias Schreiber <mathias.schreiber@typo3.com>
Tested-by: Mathias Schreiber <mathias.schreiber@typo3.com>
Reviewed-by: Susanne Moog <susanne.moog@typo3.org>
Tested-by: Susanne Moog <susanne.moog@typo3.org>
  • Loading branch information
ohader authored and susannemoog committed Mar 8, 2018
1 parent 834f936 commit cb59ac9
Show file tree
Hide file tree
Showing 15 changed files with 36 additions and 36 deletions.
6 changes: 3 additions & 3 deletions typo3/sysext/core/Configuration/TCA/be_users.php
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@
'config' => [
'type' => 'input',
'renderType' => 'inputDateTime',
'eval' => 'datetime',
'eval' => 'datetime,int',
'default' => 0
]
],
Expand All @@ -258,7 +258,7 @@
'config' => [
'type' => 'input',
'renderType' => 'inputDateTime',
'eval' => 'datetime',
'eval' => 'datetime,int',
'default' => 0,
'range' => [
'upper' => mktime(0, 0, 0, 1, 1, 2038)
Expand Down Expand Up @@ -315,7 +315,7 @@
'type' => 'input',
'renderType' => 'inputDateTime',
'readOnly' => true,
'eval' => 'datetime',
'eval' => 'datetime,int',
'default' => 0
]
],
Expand Down
8 changes: 4 additions & 4 deletions typo3/sysext/core/Configuration/TCA/pages.php
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@
'config' => [
'type' => 'input',
'renderType' => 'inputDateTime',
'eval' => 'datetime',
'eval' => 'datetime,int',
'default' => 0,
'behaviour' => [
'allowLanguageSynchronization' => true
Expand All @@ -219,7 +219,7 @@
'config' => [
'type' => 'input',
'renderType' => 'inputDateTime',
'eval' => 'datetime',
'eval' => 'datetime,int',
'default' => 0,
'range' => [
'upper' => mktime(0, 0, 0, 1, 1, 2038)
Expand Down Expand Up @@ -427,7 +427,7 @@
'config' => [
'type' => 'input',
'renderType' => 'inputDateTime',
'eval' => 'datetime',
'eval' => 'datetime,int',
'default' => 0,
'behaviour' => [
'allowLanguageSynchronization' => true
Expand All @@ -440,7 +440,7 @@
'config' => [
'type' => 'input',
'renderType' => 'inputDateTime',
'eval' => 'date',
'eval' => 'date,int',
'default' => 0,
'behaviour' => [
'allowLanguageSynchronization' => true
Expand Down
4 changes: 2 additions & 2 deletions typo3/sysext/core/Configuration/TCA/sys_category.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@
'config' => [
'type' => 'input',
'renderType' => 'inputDateTime',
'eval' => 'datetime',
'eval' => 'datetime,int',
'default' => 0,
'behaviour' => [
'allowLanguageSynchronization' => true,
Expand All @@ -128,7 +128,7 @@
'config' => [
'type' => 'input',
'renderType' => 'inputDateTime',
'eval' => 'datetime',
'eval' => 'datetime,int',
'default' => 0,
'range' => [
'upper' => mktime(0, 0, 0, 1, 1, 2038),
Expand Down
4 changes: 2 additions & 2 deletions typo3/sysext/core/Configuration/TCA/sys_collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
'config' => [
'type' => 'input',
'renderType' => 'inputDateTime',
'eval' => 'date',
'eval' => 'date,int',
'default' => 0,
]
],
Expand All @@ -106,7 +106,7 @@
'config' => [
'type' => 'input',
'renderType' => 'inputDateTime',
'eval' => 'date',
'eval' => 'date,int',
'default' => 0,
'range' => [
'upper' => mktime(0, 0, 0, 1, 1, 2038),
Expand Down
4 changes: 2 additions & 2 deletions typo3/sysext/core/Configuration/TCA/sys_file_collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
'config' => [
'type' => 'input',
'renderType' => 'inputDateTime',
'eval' => 'date',
'eval' => 'date,int',
'default' => 0,
]
],
Expand All @@ -105,7 +105,7 @@
'config' => [
'type' => 'input',
'renderType' => 'inputDateTime',
'eval' => 'date',
'eval' => 'date,int',
'default' => 0,
'range' => [
'upper' => mktime(0, 0, 0, 1, 1, 2038),
Expand Down
4 changes: 2 additions & 2 deletions typo3/sysext/core/Configuration/TCA/sys_news.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
'config' => [
'type' => 'input',
'renderType' => 'inputDateTime',
'eval' => 'datetime',
'eval' => 'datetime,int',
'default' => 0
]
],
Expand All @@ -47,7 +47,7 @@
'config' => [
'type' => 'input',
'renderType' => 'inputDateTime',
'eval' => 'datetime',
'eval' => 'datetime,int',
'default' => 0
]
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
'config' => [
'type' => 'input',
'renderType' => 'inputDateTime',
'eval' => 'datetime'
'eval' => 'datetime,int'
]
],
'update_comment' => [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@
'config' => [
'type' => 'input',
'renderType' => 'inputDateTime',
'eval' => 'date',
'eval' => 'date,int',
'default' => time()
],
],
Expand All @@ -382,7 +382,7 @@
'config' => [
'type' => 'input',
'renderType' => 'inputDateTime',
'eval' => 'date',
'eval' => 'date,int',
'default' => time()
],
],
Expand Down
6 changes: 3 additions & 3 deletions typo3/sysext/frontend/Configuration/TCA/fe_users.php
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@
'config' => [
'type' => 'input',
'renderType' => 'inputDateTime',
'eval' => 'datetime',
'eval' => 'datetime,int',
'default' => 0
]
],
Expand All @@ -242,7 +242,7 @@
'config' => [
'type' => 'input',
'renderType' => 'inputDateTime',
'eval' => 'datetime',
'eval' => 'datetime,int',
'default' => 0,
'range' => [
'upper' => mktime(0, 0, 0, 1, 1, 2038)
Expand Down Expand Up @@ -275,7 +275,7 @@
'type' => 'input',
'renderType' => 'inputDateTime',
'readOnly' => true,
'eval' => 'datetime',
'eval' => 'datetime,int',
'default' => 0
]
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
'config' => [
'type' => 'input',
'renderType' => 'inputDateTime',
'eval' => 'datetime',
'eval' => 'datetime,int',
'default' => 0
]
],
Expand All @@ -64,7 +64,7 @@
'config' => [
'type' => 'input',
'renderType' => 'inputDateTime',
'eval' => 'datetime',
'eval' => 'datetime,int',
'default' => 0,
'range' => [
'upper' => mktime(0, 0, 0, 1, 1, 2038)
Expand Down
4 changes: 2 additions & 2 deletions typo3/sysext/frontend/Configuration/TCA/sys_template.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
'config' => [
'type' => 'input',
'renderType' => 'inputDateTime',
'eval' => 'datetime',
'eval' => 'datetime,int',
'default' => 0
]
],
Expand All @@ -63,7 +63,7 @@
'config' => [
'type' => 'input',
'renderType' => 'inputDateTime',
'eval' => 'datetime',
'eval' => 'datetime,int',
'default' => 0,
'range' => [
'upper' => mktime(0, 0, 0, 1, 1, 2038)
Expand Down
6 changes: 3 additions & 3 deletions typo3/sysext/frontend/Configuration/TCA/tt_content.php
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@
'config' => [
'type' => 'input',
'renderType' => 'inputDateTime',
'eval' => 'datetime',
'eval' => 'datetime,int',
'default' => 0
],
'l10n_mode' => 'exclude',
Expand All @@ -249,7 +249,7 @@
'config' => [
'type' => 'input',
'renderType' => 'inputDateTime',
'eval' => 'datetime',
'eval' => 'datetime,int',
'default' => 0,
'range' => [
'upper' => mktime(0, 0, 0, 1, 1, 2038)
Expand Down Expand Up @@ -453,7 +453,7 @@
'config' => [
'type' => 'input',
'renderType' => 'inputDateTime',
'eval' => 'date',
'eval' => 'date,int',
'default' => 0
]
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
'config' => [
'type' => 'input',
'renderType' => 'inputDateTime',
'eval' => 'date',
'eval' => 'date,int',
'default' => 0,
]
],
Expand Down Expand Up @@ -182,7 +182,7 @@
'config' => [
'type' => 'input',
'renderType' => 'inputDateTime',
'eval' => 'datetime',
'eval' => 'datetime,int',
'default' => 0,
]
],
Expand All @@ -191,7 +191,7 @@
'config' => [
'type' => 'input',
'renderType' => 'inputDateTime',
'eval' => 'time',
'eval' => 'time,int',
'default' => 3600
]
],
Expand Down
6 changes: 3 additions & 3 deletions typo3/sysext/redirects/Configuration/TCA/sys_redirect.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
'config' => [
'type' => 'input',
'renderType' => 'inputDateTime',
'eval' => 'datetime',
'eval' => 'datetime,int',
'default' => 0
]
],
Expand All @@ -78,7 +78,7 @@
'config' => [
'type' => 'input',
'renderType' => 'inputDateTime',
'eval' => 'datetime',
'eval' => 'datetime,int',
'default' => 0,
'range' => [
'upper' => mktime(0, 0, 0, 1, 1, 2038)
Expand Down Expand Up @@ -185,7 +185,7 @@
'label' => 'LLL:EXT:redirects/Resources/Private/Language/locallang_db.xlf:sys_redirect.lasthiton',
'config' => [
'type' => 'input',
'eval' => 'datetime',
'eval' => 'datetime,int',
'renderType' => 'inputDateTime',
'readOnly' => true
],
Expand Down
4 changes: 2 additions & 2 deletions typo3/sysext/workspaces/Configuration/TCA/sys_workspace.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
'config' => [
'type' => 'input',
'renderType' => 'inputDateTime',
'eval' => 'datetime',
'eval' => 'datetime,int',
'default' => 0,
]
],
Expand All @@ -92,7 +92,7 @@
'config' => [
'type' => 'input',
'renderType' => 'inputDateTime',
'eval' => 'datetime',
'eval' => 'datetime,int',
'default' => 0,
'range' => [
'upper' => mktime(0, 0, 0, 1, 1, 2038)
Expand Down

0 comments on commit cb59ac9

Please sign in to comment.