diff --git a/typo3/sysext/backend/Classes/Form/Element/AbstractFormElement.php b/typo3/sysext/backend/Classes/Form/Element/AbstractFormElement.php index e48be6b947a0501438693b9de3797186a0888068..27866c5276bb7fb6319fc24e161452a6796f67b6 100644 --- a/typo3/sysext/backend/Classes/Form/Element/AbstractFormElement.php +++ b/typo3/sysext/backend/Classes/Form/Element/AbstractFormElement.php @@ -296,7 +296,8 @@ abstract class AbstractFormElement extends AbstractNode default: // Do nothing e.g. when $format === '' } - return $itemValue; + // Make sure we have a string in the end. $itemValue could be null, for instance. + return (string)$itemValue; } /** diff --git a/typo3/sysext/backend/Classes/Form/Element/InputDateTimeElement.php b/typo3/sysext/backend/Classes/Form/Element/InputDateTimeElement.php index 19a17976d412d44b8f6e4f47a43e8e6044e21e77..46d19a4303d932c9349761efd4e29c73e4c378a3 100644 --- a/typo3/sysext/backend/Classes/Form/Element/InputDateTimeElement.php +++ b/typo3/sysext/backend/Classes/Form/Element/InputDateTimeElement.php @@ -198,7 +198,7 @@ class InputDateTimeElement extends AbstractFormElement $expansionHtml[] = '<div class="form-wizards-element">'; $expansionHtml[] = '<div class="input-group">'; $expansionHtml[] = '<input type="text" ' . GeneralUtility::implodeAttributes($attributes, true) . ' />'; - $expansionHtml[] = '<input type="hidden" name="' . $parameterArray['itemFormElName'] . '" value="' . htmlspecialchars($itemValue) . '" />'; + $expansionHtml[] = '<input type="hidden" name="' . $parameterArray['itemFormElName'] . '" value="' . htmlspecialchars((string)$itemValue) . '" />'; $expansionHtml[] = '<button class="btn btn-default" type="button" data-global-event="click" data-action-focus="#' . $attributes['id'] . '">'; $expansionHtml[] = $this->iconFactory->getIcon('actions-edit-pick-date', Icon::SIZE_SMALL)->render(); $expansionHtml[] = '</button>'; diff --git a/typo3/sysext/backend/Tests/Unit/Form/Element/AbstractFormElementTest.php b/typo3/sysext/backend/Tests/Unit/Form/Element/AbstractFormElementTest.php index b9174ee599027eeaae5409e1eec9fac91cd5ede1..3408dfd1b16185f8a39c6fba0cfb3d3a4cbf60b8 100644 --- a/typo3/sysext/backend/Tests/Unit/Form/Element/AbstractFormElementTest.php +++ b/typo3/sysext/backend/Tests/Unit/Form/Element/AbstractFormElementTest.php @@ -279,6 +279,6 @@ class AbstractFormElementTest extends UnitTestCase $result = $subject->_call('formatValue', $config['format'], $itemValue, $config['format.'] ?? []); date_default_timezone_set($timezoneBackup); - self::assertEquals($expectedResult, $result); + self::assertSame($expectedResult, $result); } }