Project

General

Profile

Actions

Bug #66423

closed

FAL Indexer createIndexEntry careless about non-string compatible values in exception message

Added by Claus Due over 9 years ago. Updated over 5 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
File Abstraction Layer (FAL)
Target version:
-
Start date:
2015-04-14
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
6.2
PHP Version:
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

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.

Actions #1

Updated by Riccardo De Contardi about 9 years ago

  • Category set to File Abstraction Layer (FAL)
Actions #2

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?

Actions #3

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.

Actions

Also available in: Atom PDF