Bug #50342

PropertyMapper: Use of interface method before implementation check

Added by Mathias Brodala about 2 years ago.

Status:New Start date:2013-07-23
Priority:Could have Due date:
Assigned To:- % Done:

0%

Category:-
Target version:-
PHP Version: Complexity:
Has patch:No Affected Flow version:(any)

Description

On the following line the PropertyMapper uses a method of the TypeConverterInterface but performs the actual check for it afterwards:

http://forge.typo3.org/projects/package-typo3-flow/repository/revisions/e0f7cfdcfed54e326ac4b5852f81cfe2e2fce032/entry/Classes/TYPO3/Flow/Property/PropertyMapper.php#L153

$targetType = $typeConverter->getTargetTypeForSource($source, $targetType, $configuration);

if (!is_object($typeConverter) || !($typeConverter instanceof \TYPO3\Flow\Property\TypeConverterInterface)) {
  throw new Exception\TypeConverterException('Type converter for "' . $source . '" -> "' . $targetType . '" not found.');
}

Shouldn't the check be performed first and output the original $targetType on failure?

Also available in: Atom PDF