Project

General

Profile

Actions

Bug #50802

closed

FolderBasedFileCollection::loadContents() doesn't check if folder is present

Added by Frans Saris over 11 years ago. Updated about 6 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
File Abstraction Layer (FAL)
Target version:
-
Start date:
2013-08-05
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
6.1
PHP Version:
Tags:
Complexity:
no-brainer
Is Regression:
Sprint Focus:

Description

in FolderBasedFileCollection::loadContents() there is no check if the folder object is present this can result in a fatal error.

    Call to a member function getFiles() on a non-object in typo3/sysext/core/Classes/Resource/Collection/FolderBasedFileCollection.php on line 73

*example usage:

            /** @var $fileCollection \TYPO3\CMS\Core\Resource\Collection\AbstractFileCollection */
            $fileCollection = $this->fileCollectionRepository->findByUid($this->getUid());
            $fileCollection->loadContents();
            $this->assets = $fileCollection->getItems();

There is no way to check if the initialization of the object was successful so you currently can not prevent the error.

Fix:
Check in FolderBasedFileCollection::loadContents() if $this->folder is initialized.

Actions

Also available in: Atom PDF