Project

General

Profile

Actions

Bug #89857

closed

Insufficient case statement in Extbase DataMapper

Added by Florian Wessels over 4 years ago. Updated about 4 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Extbase
Target version:
-
Start date:
2019-12-05
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
9
PHP Version:
7.2
Tags:
Complexity:
Is Regression:
Sprint Focus:

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.


Related issues 2 (0 open2 closed)

Related to TYPO3 Core - Bug #90992: Fix programming error that only works for subtle reasonsClosed2020-04-09

Actions
Related to TYPO3 Core - Bug #90996: Exception message hard to readClosedGeorg Ringer2020-04-10

Actions
Actions

Also available in: Atom PDF