Project

General

Profile

Actions

Bug #88712

closed

Type casting error on MySQL time field for TCA type input / dbType time saving empty time field

Added by Denis Mir over 5 years ago. Updated over 4 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
-
Target version:
-
Start date:
2019-07-10
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
9
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

I'm trying to have a time input in TYPO3 9 LTS working together with MySQL 5.7.24.

In the ext_tables.sql the field gets defined like this:

some_field time default NULL

In the TCA the field gets defined like this:

  'some_field' => [
    'exclude' => 1,
    'label' => 'Some field',
    'config' => [
      'type' => 'input',
      'dbType' => 'time',
      'eval' => 'time',
    ],
  ],

(like described here https://docs.typo3.org/m/typo3/reference-tca/master/en-us/ColumnsConfig/Type/Input.html#dbtype)

When saving the record in the backend without a time input (which should be possible) I'm getting the error:

These fields of record 1 in table "some_table" have not been saved correctly: some_field! The values might have changed due to type casting of the database.

When looking at the database record the "some_field" field gets the value "00:00:00" (although the db default is NULL). So I would think that TYPO3 does save here some unexpected default value which gets casted by the database to "00:00:00".

When selecting a time the record can be saved and opened without error. So this does work fine. So there is just a problem with when saving the empty field

Actions #1

Updated by Denis Mir over 5 years ago

I have found a way to make it work.

'eval' => 'time,null',

Adding the "null" to the "eval" part fixes the problem.

Actions #2

Updated by Georg Ringer over 4 years ago

  • Status changed from New to Resolved
Actions #4

Updated by Benni Mack over 4 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF