Project

General

Profile

Bug #62536

Updated by Daniel Siepmann about 10 years ago

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: 
 <pre> 
       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; 
       } 
 </pre> 
 And the new one: 
 <pre> 
       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; 
       } 
 </pre> 

 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. 0. 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?

Back