Issue Bug Closed

#89857Insufficient case statement in Extbase DataMapper

Florian Wessels 12/05/19, 11:52 updated 04/01/20, 21:14

Description

The result of the switch statement in thawProperties method of \TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapper has an insufficient case statement (l. 306).

A domain object with a property $foo is given and the @var annotation is missing (which, of course, is a bug that has to be fixed by the extension developer) for that property. However, the resulting error title / message is:
> #1288965219 InvalidArgumentException – $className must be a non empty string.
And this is very confusing.

Following variable and condition are given:

$propertyData['type'] = null;
is_subclass_of($propertyData['type'], \DateTimeInterface::class) --> evaluates to false.

As the switch function only checks for equal values and not for identically values the following condition is evaluated as true.

$propertyData['type'] == is_subclass_of($propertyData['type'], \DateTimeInterface::class)

Possible solutions:
There should be a check for null values prior to the switch function.

This glitch is still present in current dev-master.

Reviews 4