Task #102263
closedReturn string version of Stringable objects in DataMapper::getPlainValue
100%
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)) {`
Updated by Gerrit Code Review over 1 year 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
Updated by Gerrit Code Review over 1 year 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
Updated by Soren Malling over 1 year ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset d5043eb1214e40134f588eb16fe6174b0bee8984.