Project

General

Profile

Bug #79304

Updated by Markus Klein over 7 years ago

If a TCA input field of dbType datetime is saved with an empty value a SQL error is triggered. 

 <pre> 
 1: These fields of record 1 in table "tx_datetimetest_domain_model_history" have not been saved correctly: date_time_native! The values might have changed due to type casting of the database. 
 </pre> 

 Example configuration (from styleguide extension) 
 <pre> 
         'input_37' => [ 
             'exclude' => 1, 
             'label' => 'input_37 dbType=datetime eval=datetime', 
             'config' => [ 
                 'dbType' => 'datetime', 
                 'type' => 'input', 
                 'size' => 20, 
                 'eval' => 'datetime', 
                 'checkbox' => 0, 
                 'default' => '0000-00-00 00:00:00' 
             ], 
         ], 
 </pre> 

 <pre> 
 2: SQL error: 'Incorrect datetime value: '0' for column 'input_37' at row 1' (tx_styleguide_elements_basic:1) 
 </pre> 

 This can be reproduced with the Acceptance tests 
 @./bin/codecept run -f Acceptance -c components/testing_framework/core/Build/AcceptanceTests.yml typo3/sysext/core/Tests/Acceptance/Backend/Formhandler/ElementsBasicCest.php:checkThatValidationWorks_EvalDateTime_DbTypeDateTime@ 

 They (sometimes) are successfull but the sql error message is visible for a short time

Back