Project

General

Profile

Actions

Bug #103122

closed

FileLinkHandler: false return value not taken into account

Added by Gernot Leitgab 9 months ago. Updated 5 months ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Miscellaneous
Target version:
-
Start date:
2024-02-14
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
11
PHP Version:
Tags:
Complexity:
Is Regression:
Yes
Sprint Focus:

Description

With the latest security patch version 11.5.35 the following lines where added to "\TYPO3\CMS\Recordlist\LinkHandler\FileLinkHandler::render()":

        if ($selectedFolder->getStorage()->isFallbackStorage()) {
            $selectedFolder = null;
        }

https://github.com/TYPO3-CMS/recordlist/compare/v11.5.34...v11.5.35#diff-606331e26a505d19f3d851b0ac8c71433f861a2074c9e31b5077088e7d8e69e1

The variable "$selectedFolder" can be "false", because the previous line is "$selectedFolder = $this->getSelectedFolder($this->expandFolder);" and the return value of "getSelectedFolder()" can be a folder object or "false". The "false" return value is not taken into account in the newly added code, which results in an exception.


Related issues 1 (0 open1 closed)

Is duplicate of TYPO3 Core - Bug #103116: Oops, an error occurred! Call to a member function getStorage() on boolClosed2024-02-14

Actions
Actions #1

Updated by Gernot Leitgab 9 months ago

Possible solution would be:

        if ($selectedFolder === false || $selectedFolder->getStorage()->isFallbackStorage()) {
            $selectedFolder = null;
        }

Actions #2

Updated by Gerrit Code Review 9 months ago

  • Status changed from New to Under Review

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

Actions #3

Updated by Gerrit Code Review 9 months ago

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

Actions #4

Updated by Gerrit Code Review 9 months ago

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

Actions #5

Updated by Markus Klein 9 months ago

  • Is duplicate of Bug #103116: Oops, an error occurred! Call to a member function getStorage() on bool added
Actions #6

Updated by Benjamin Franzke 9 months ago

Hi Gernot,

The code in v11 is wrong and needs to be updated. Thanks for the report.
One question: Did you actually run into the exception in v11, or did you face the error in an ELTS instance and noticed that the coding mistake is available in v11 as well?

(I'm asking because I couldn't reproduce in v11)

Thanks, Benjamin

Actions #7

Updated by Benjamin Franzke 9 months ago

nevermind, found it: getSelectedFolder() return false if backend user has no "default" upload folder, which is the case when all storages are marked non-writable. With that the error is actually reproducible in v11 when trying to create a new file link.

Actions #8

Updated by Gerrit Code Review 9 months ago

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

Actions #9

Updated by Andreas Fernandez 9 months ago

  • Status changed from Under Review to Resolved
Actions #10

Updated by Benni Mack 5 months ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF