Bug #50342

PropertyMapper: Use of interface method before implementation check

Added by Mathias Brodala over 6 years ago.

Status:
New
Priority:
Could have
Assignee:
-
Category:
-
Target version:
-
Start date:
2013-07-23
Due date:
% Done:

0%

PHP Version:
Has patch:
No
Complexity:

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