Can't remove access starttime / endtime
I can't remove the access start and endtime of tt_content block.
Create a tt_content block. Set start and or end time under the access tab. Save it. When you remove the start or end time an error will popup.
2: SQL error: 'Incorrect integer value: '' for column 'starttime' at row 1' (tt_content:44)
I use typo3 version 8.7.7
Updated by Mike van Dee almost 4 years ago
Wouter Wolters wrote:
This works on my system. Looks like your column in the database has a wrong default value or some hook is involved.
Can you setup a clean TYPO3 and try again?
I use strict MySQL(5.7.17) database.
The tt_content table has fields:
`starttime` int(10) unsigned NOT NULL DEFAULT '0',
`endtime` int(10) unsigned NOT NULL DEFAULT '0',
When you clear the start/endtime an empty string('') is send to the database.
Clearing start/endtime works in typo3 version 8.7.1 or lower. And gives me an error on version 8.7.2 and higher.
Updated by Mike van Dee over 3 years ago
Daniel Siepmann wrote:
As far as I know, TYPO3 does not work with MySQL strict mode.
I can't find where it's documented, but we do not experience the same issue if we turn off strict mode.
Here is an forge task that implies that typo3 supports MySQL Strict mode. https://forge.typo3.org/issues/72610
Updated by Rick Feuerabend over 3 years ago
as a workaround adding "int" eval additionally does the trick!
with that datetime or date fields can be set empty without MySQL Error
$GLOBALS['TCA']['tt_content']['columns']['starttime']['config']['eval'] .= ',int';
Can someony please apply the fixes in the core?
Updated by Rudy Gnodde over 3 years ago
- % Done changed from 100 to 0
Shouldn't this actually be fixed instead of using the workaround in the core? This patch doesn't fix it for extensions that also use datetime fields. I'm not very familiar with the DataHandler, but can't you cast it to int or set it to zero if a field has eval date/datetime and the value is an empty string?
Updated by Markus Klein over 3 years ago
- Status changed from Resolved to Accepted
- Complexity set to hard
We reopen this ticket.
The issues we are facing currently are:
- MySQL in strict mode does not accept an empty string written to an integer database field
- The TCA default value is only applied to fields on creation of new records, not when updating one. (E.g. removing an endtime)
- Writing a correct integer value to a database that uses another datatype for this field (e.g. a
varchar) will fail on certain DMBS too, for instance MS SQL Server
- FormEngine currently does not support
NULLvalues for these fields (
NULLmeans "unknown / undefined", whereas
0has a defined meaning for (date)time), which would be the correct value when not specifying a date.
The solution to all these problem is not doable with a bugfix but requires a more thorough refactoring to the core.
Due to these reasons we applied a workaround as a first counter-measure to the core, but for your extensions you have to apply the workaround as well.