Project

General

Profile

Actions

Task #78953

closed

Custom FormDataProvider breaks with date related changes

Added by Georg Ringer almost 8 years ago. Updated over 7 years ago.

Status:
Closed
Priority:
Must have
Assignee:
-
Category:
FormEngine aka TCEforms
Target version:
Start date:
2016-12-11
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
8
PHP Version:
Tags:
Complexity:
Sprint Focus:

Description

IMO since the changes of behaviour for date & time fields, at least the extension news breaks with the exception

DateTime::__construct(): Failed to parse time string (2016-12-11T19:41:00+) at position 19 (+): Unexpected character 

How to reproduce:
- install news master
- create a new record
- bam!

Problem is that I do this

$result['databaseRow']['datetime'] = $GLOBALS['EXEC_TIME'];

that means that the change must be at least considered as breaking and the rst must be changed or otherwise allow timestamps and migrate that!

stack trace

DateTime::__construct(): Failed to parse time string (2016-12-13T16:08:04+) at position 19 (+): Unexpected character 

Exception thrown in file
/app/web/typo3/sysext/core/Classes/DataHandling/DataHandler.php in line 2713.

17 DateTime::__construct("2016-12-13T16:08:04+")

/app/web/typo3/sysext/core/Classes/DataHandling/DataHandler.php:
02711:                     } else {
02712:                         // ISO 8601 dates
02713:                         $dateTime = new \DateTime($value);
02714:                         // The returned timestamp is always UTC
02715:                         $value = $dateTime->getTimestamp();

16 TYPO3\CMS\Core\DataHandling\DataHandler::checkValue_input_Eval("2016-12-13T16:08:04+", array, NULL)

/app/web/typo3/sysext/core/Classes/DataHandling/DataHandler.php:
01790:             }
01791: 
01792:             $res = $this->checkValue_input_Eval($value, $evalCodesArray, $tcaFieldConf['is_in']);
01793: 
01794:             // Process UNIQUE settings:

15 TYPO3\CMS\Core\DataHandling\DataHandler::checkValueForInput("2016-12-13T16:08:04+", array, "tx_news_domain_model_news", "NEW58501ce4e3bba638647143", 8, "datetime")

/app/web/typo3/sysext/core/Classes/DataHandling/DataHandler.php:
01681:                 break;
01682:             case 'input':
01683:                 $res = $this->checkValueForInput($value, $tcaFieldConf, $table, $id, $realPid, $field);
01684:                 break;
01685:             case 'check':

14 TYPO3\CMS\Core\DataHandling\DataHandler::checkValue_SW(array, "2016-12-13T16:08:04+00:00", array, "tx_news_domain_model_news", "NEW58501ce4e3bba638647143", NULL, "new", 8, NULL, "datetime", NULL, 8)

/app/web/typo3/sysext/core/Classes/DataHandling/DataHandler.php:
01640: 
01641:         // Perform processing:
01642:         $res = $this->checkValue_SW($res, $value, $tcaFieldConf, $table, $id, $curValue, $status, $realPid, $recFID, $field, $this->uploadedFileArray[$table][$id][$field], $tscPID);
01643:         return $res;
01644:     }

13 TYPO3\CMS\Core\DataHandling\DataHandler::checkValue("tx_news_domain_model_news", "datetime", "2016-12-13T16:08:04+00:00", "NEW58501ce4e3bba638647143", "new", 8, 8)

/app/web/typo3/sysext/core/Classes/DataHandling/DataHandler.php:
01484:                     if (isset($GLOBALS['TCA'][$table]['columns'][$field])) {
01485:                         // Evaluating the value
01486:                         $res = $this->checkValue($table, $field, $fieldValue, $id, $status, $realPid, $tscPID);
01487:                         if (array_key_exists('value', $res)) {
01488:                             $fieldArray[$field] = $res['value'];

12 TYPO3\CMS\Core\DataHandling\DataHandler::fillInFieldArray("tx_news_domain_model_news", "NEW58501ce4e3bba638647143", array, array, 8, "new", 8)

/app/web/typo3/sysext/core/Classes/DataHandling/DataHandler.php:
01204:                 }
01205:                 // Processing of all fields in incomingFieldArray and setting them in $fieldArray
01206:                 $fieldArray = $this->fillInFieldArray($table, $id, $fieldArray, $incomingFieldArray, $theRealPid, $status, $tscPID);
01207:                 $newVersion_placeholderFieldArray = [];
01208:                 if ($createNewVersion) {

11 TYPO3\CMS\Core\DataHandling\DataHandler::process_datamap()


Related issues 2 (0 open2 closed)

Related to TYPO3 Core - Task #77702: Use moment.js and ISO-8601 dates in the backendClosedAndreas Wolf2016-08-30

Actions
Related to TYPO3 Core - Bug #80022: DateTime parse error on edit pages field newUntilClosed2017-02-25

Actions
Actions #1

Updated by Georg Ringer almost 8 years ago

  • Status changed from New to Accepted
Actions #2

Updated by Georg Ringer almost 8 years ago

  • Description updated (diff)
Actions #3

Updated by Oliver Hader almost 8 years ago

  • Category set to FormEngine aka TCEforms
  • Target version set to 8.5
Actions #4

Updated by Oliver Hader almost 8 years ago

  • Status changed from Accepted to Needs Feedback

The datetime field of the news model is configured like this in current master:

        'datetime' => [
            'exclude' => 0,
            'label' => $ll . 'tx_news_domain_model_news.datetime',
            'config' => [
                'type' => 'input',
                'size' => 16,
                'max' => 20,
                'eval' => 'datetime' . ($configuration->getDateTimeRequired() ? ',required' : ''),
            ]
        ],

The delivered date-string 2016-12-13T16:08:04+00:00 (25 chars) is cut down to 2016-12-13T16:08:04+ (20 chars) as it's defined with the max property in TCA. Changing the max value to 25 resolves the bug.

To avoid this we could maybe avoid calling the max-limit in DataHandler:checkValueForInput() if a date-string is given.

Actions #5

Updated by Georg Ringer almost 8 years ago

thx a lot! works now. up to you if the core should change there

Actions #6

Updated by Susanne Moog almost 8 years ago

I would not ignore the max property in case of dates as that creates "hidden magic" and makes the behaviour unpredictable - sometimes max is taken into account sometimes it's not. If the user sets max it should be taken into account, so that the responsibility for setting a sensible max value lies with the developer ;)

Actions #7

Updated by Oliver Hader almost 8 years ago

Maybe that's something for a TCA migration/validation? I would not see a change and another exception in DataHandler however.

Actions #8

Updated by Benni Mack almost 8 years ago

  • Target version changed from 8.5 to 8.6
Actions #9

Updated by NewtVision no-lastname-given almost 8 years ago

Oliver Hader wrote:

The datetime field of the news model is configured like this in current master:

[...]

The delivered date-string 2016-12-13T16:08:04+00:00 (25 chars) is cut down to 2016-12-13T16:08:04+ (20 chars) as it's defined with the max property in TCA. Changing the max value to 25 resolves the bug.

To avoid this we could maybe avoid calling the max-limit in DataHandler:checkValueForInput() if a date-string is given.

All fields with eval datetime or $configuration->getArchiveDate() in news are affected to this limitation (datetime, archive, start and end).

What solution will be adopted to fix the problem news or core?

Thanks to all.

Actions #10

Updated by Benni Mack almost 8 years ago

  • Target version changed from 8.6 to 8 LTS
Actions #11

Updated by Joerg Kummer over 7 years ago

There is one more TCA configuration for page entries in core for field newUntil, which leads to such error.

See #80022

Actions #12

Updated by Georg Ringer over 7 years ago

  • Status changed from Needs Feedback to Closed
Actions

Also available in: Atom PDF