Project

General

Profile

Actions

Bug #62536

closed

Extbase TypeConverter Integer can't work with null anymore

Added by Daniel Siepmann about 10 years ago. Updated over 9 years ago.

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

0%

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

Description

While migrating our TYPO3 4.7 instance to 6.2 we found out that the new TypeConverter for integers can't convert "null" anymore.

This is the old code:

      public function convertFrom($source, $targetType, array $convertedChildProperties = array(), \TYPO3\CMS\Extbase\Property\PropertyMappingConfigurationInterface $configuration = NULL) {
            if ($source === NULL || strlen($source) === 0) {
                  return NULL;
            }
            if (!is_numeric($source)) {
                  return new \TYPO3\CMS\Extbase\Error\Error('"%s" is no integer.', 1332933658, array($source));
            }
            return (int)$source;
      }

And the new one:
      public function convertFrom($source, $targetType, array $convertedChildProperties = array(), \TYPO3\CMS\Extbase\Property\PropertyMappingConfigurationInterface $configuration = NULL) {
            if (strtolower($source) === "null" || $source === NULL || strlen($source) === 0) {
                  return NULL;
            }
            if (!is_numeric($source)) {
                  return new \TYPO3\CMS\Extbase\Error\Error('"%s" is no integer.', 1332933658, array($source));
            }
            return (int)$source;
      }

The file is located under /typo3/sysext/extbase/Classes/Property/TypeConverter/IntegerConverter.php.

The problem is that null as a string can't be converted to null. This worked in 4.7 and is a breaking change for our extensions.

If this is behavior is intended, where is the change documented?
Looks like the following commit introduced this: https://git.typo3.org/Packages/TYPO3.CMS.git/blobdiff/c60a671bb5d7e4b21ef55ffee0028b32d66cad55..8c3f329a18b9496d270ae2467025bf3fee720c49:/typo3/sysext/extbase/Classes/Property/TypeConverter/IntegerConverter.php So FLOW differs from the old Extbase way. Perhaps the context is different and the string is managed before inside FLOW?

Actions

Also available in: Atom PDF