Project

General

Profile

Actions

Bug #80541

closed

BE FileBrowser didn't work in fluid content element

Added by Mélanie GALVEZ about 7 years ago. Updated over 5 years ago.

Status:
Closed
Priority:
Must have
Assignee:
Category:
Backend User Interface
Start date:
2017-03-29
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
8
PHP Version:
7.1
Tags:
Complexity:
medium
Is Regression:
Yes
Sprint Focus:

Description

FileBrowser popup didn't works when clicking on button in fluid content element

The reason is that $className is null in the getElementBrowserInstance method of the file typo3/sysext/recordlist/Classes/Controller/ElementBrowserController.php

To fix it, simply add :

if(empty($className))
{
   $className = 'TYPO3\CMS\Recordlist\Browser\FileBrowser';
}

before this line :

$className = $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ElementBrowsers'][$this->mode];


Related issues 1 (0 open1 closed)

Has duplicate TYPO3 Core - Bug #80727: $className must be a non empty stringClosed2017-04-06

Actions
Actions #1

Updated by Markus Klein about 7 years ago

  • Status changed from New to Needs Feedback

Well this dialog is actually not meant for Frontend usage. Actually I'm not sure if you run in security issues if you do.

Actions #2

Updated by Oliver Pfaff about 7 years ago

  • Has duplicate Bug #80727: $className must be a non empty string added
Actions #3

Updated by Oliver Pfaff about 7 years ago

Moin,
i have done some research because im encountered the same issue in the DCE extension.
Your solution will work, but seems not TYPO3 style :).
If you set the internal_type inside the TCA to file it will work also but don't seems the right way. it would be the right way if the internal type 'file_reference' was removed but i dont have find anything about it

The error is caused by this js call:
- onclick="setFormValueOpenBrowser('file_reference' ...
- file_reference seems to be the internal type inside the TCA config

in TYPO3 7.15 my onclick event is rendered with 'file' only and so we get the right class name. 'TYPO3\CMS\Recordlist\Browser\FileBrowser'.
Stored inside
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ElementBrowsers']['file'];
and called on line 147(7.6)-144(8.7) in ElementBrowserController.php

In 7.6 we don't have $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ElementBrowsers']['file_reference']; either.

So the error seems to be in the rendering process. I suppose that anywhere there, when the internal_type is file_reference, the mode will set on file before the output is generated and this is broken right now in 8.7.

But i can't identify the right spot in the core right now

@Mélanie GALVEZ can you tell us wich kind of fluid element you have used? I have tried some element but there i can't reproduce the error.

Actions #4

Updated by Claus Due almost 7 years ago

This happens on any record type anywhere, if it contains a flexform with a section and section object and one or more fields of type "group" internal type "file_reference". I would also assume this happens anywhere if you use a "group" field with internal type "file_reference". As such, it's neither related to frontend or specifically to fluidcontent (it's just easier to reproduce with an EXT:fluidcontent or EXT:fluidpages template's Flux form, if you've already got one).

Boils down to: "file" vs. "file_reference" type in "group" TCA fields; browse feature broken with "file_reference".

it would be the right way if the internal type 'file_reference' was removed but i dont have find anything about it

I don't see why that would be removed. File and FileReference both serve their proper purpose for this component. And until it gets deprecated it's definitely still proper API and should be supported ;)

Actions #5

Updated by Tabea David almost 7 years ago

Any news on this? I've got the same issue.
The fix mentioned above works, but the line has to be placed after and not before the line `$className = ...`:

──────────────────────────────────────────────────────────────────────────────────────────────────────────
modified: typo3_src-8.7.1/typo3/sysext/recordlist/Classes/Controller/ElementBrowserController.php
──────────────────────────────────────────────────────────────────────────────────────────────────────────
@ ElementBrowserController.php:144 @ class ElementBrowserController
    protected function getElementBrowserInstance()
    {
        $className = $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ElementBrowsers'][$this->mode];
+       if (empty($className)) $className = 'TYPO3\CMS\Recordlist\Browser\FileBrowser';
        $browser = GeneralUtility::makeInstance($className);
        if (!$browser instanceof ElementBrowserInterface) {
Actions #6

Updated by Markus Klein almost 7 years ago

  • Description updated (diff)
  • Status changed from Needs Feedback to New
  • Target version set to Candidate for patchlevel
Actions #7

Updated by Markus Klein almost 7 years ago

Is version 7 also affected?

In general seeing this error means that the mode is not set via GET parameter.
The bug is therefore in the calling code and not in the ElementBrowserController.

The provided "fix" is rather a dirty workaround.

Actions #8

Updated by Tobias Gülzow almost 7 years ago

Hi everyone.

Our sightly less hacky workaround here is:

$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ElementBrowsers']['file_reference'] = 'TYPO3\CMS\Recordlist\Browser\FileBrowser';

Using this in an ext_localconf makes the filebrowser work again.

Sadly, the Backend complains about missing files, but this looks like a false alert.
Saving the element works as it should.
The display on the frontend is as it should be.

Tobi

Actions #9

Updated by Markus Klein almost 7 years ago

  • Assignee set to Markus Klein
  • Priority changed from Should have to Must have
Actions #10

Updated by Markus Klein almost 7 years ago

  • Status changed from New to Accepted
  • Complexity set to medium
  • Is Regression changed from No to Yes
  • Sprint Focus set to On Location Sprint
Actions #11

Updated by Anja Leichsenring over 6 years ago

  • Sprint Focus deleted (On Location Sprint)
Actions #12

Updated by Kurt Gusbeth over 5 years ago

Why is this bug still not fixed in TYPO3 8.7.17?
Adding this line

if (empty($className)) $className = 'TYPO3\CMS\Recordlist\Browser\FileBrowser';

helped for me.

Actions #13

Updated by Gerrit Code Review over 5 years ago

  • Status changed from Accepted to Under Review

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

Actions #14

Updated by Gerrit Code Review over 5 years ago

Patch set 1 for branch TYPO3_8-7 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/58435

Actions #15

Updated by Christian Kuhn over 5 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
Actions #16

Updated by Gerrit Code Review over 5 years ago

  • Status changed from Resolved to Under Review

Patch set 2 for branch TYPO3_8-7 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/58435

Actions #17

Updated by Gerrit Code Review over 5 years ago

Patch set 3 for branch TYPO3_8-7 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/58435

Actions #18

Updated by Christian Kuhn over 5 years ago

  • Status changed from Under Review to Resolved
Actions #19

Updated by Benni Mack over 5 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF