Project

General

Profile

Actions

Task #102263

closed

Return string version of Stringable objects in DataMapper::getPlainValue

Added by Soren Malling 6 months ago. Updated 3 months ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Extbase
Target version:
-
Start date:
2023-10-26
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
12
PHP Version:
Tags:
Complexity:
Sprint Focus:

Description

The DataMapper::getPlainValue expects a object to be a instance of TypeInterface in order to return a plain value.

The TypoInterface holds the `__toString` method - making it `a instance of Stringable`.

Objects/value objects coming from own extensions, not implementing the TypeInterface but being a `Stringable` (either by `implements \Stringable` or having the `__toString` method) throws the exception

`throw new UnexpectedTypeException('An object of class "' . get_class($input) . '" could not be converted to a plain value.', 1274799934);`

Suggestion here, being that the condition also allows a object being a stringable

From:
`if (TypeHandlingUtility::isCoreType($input)) {`

To:
`if (TypeHandlingUtility::isCoreType($input) || ($input instanceof \Stringable)) {`

Actions #1

Updated by Gerrit Code Review 6 months ago

  • Status changed from New to Under Review

Patch set 1 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/81576

Actions #2

Updated by Oliver Hader 6 months ago

  • Category set to Extbase
Actions #3

Updated by Gerrit Code Review 6 months ago

Patch set 1 for branch 12.4 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/81579

Actions #4

Updated by Soren Malling 6 months ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
Actions #5

Updated by Benni Mack 3 months ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF