Bug #66423
closedFAL Indexer createIndexEntry careless about non-string compatible values in exception message
0%
Description
As topic says: when Indexer::createIndexEntry is called with something that is not string-compatible (which is the case for File instances, for example) then the possibly-object variable $identifier is inserted as part of the exception message without first checking if it can be converted to a string. Subsequently, the error message that gets dispatched is a php warning converted to exception - instead of the intended InvalidArgumentException.
Suggested fix: check type of variable; if object without __toString, use gettype($identifier) as part of exception message instead.
Updated by Riccardo De Contardi about 9 years ago
- Category set to File Abstraction Layer (FAL)
Updated by Susanne Moog over 5 years ago
- Status changed from New to Needs Feedback
Not sure I get it, the current code does:
if (!isset($identifier) || !is_string($identifier) || $identifier === '') {
throw new \InvalidArgumentException(
'Invalid file identifier given. It must be of type string and not empty. "' . gettype($identifier) . '" given.',
1401732565
);
}
So it's not string casting the value. But as far as I can see that code is there since the exception was introduced in https://review.typo3.org/c/Packages/TYPO3.CMS/+/30526 - so I don't get if we have an issue at all. Can you recheck?
Updated by Riccardo De Contardi over 5 years ago
- Status changed from Needs Feedback to Closed
This is very old; I close this one for now in agreement with the reporter; if the issue ever comes back it can be reopened or a new issue could be recreated.
Thank you.