Bug #80541

BE FileBrowser didn't work in fluid content element

Added by Mélanie GALVEZ over 2 years ago. Updated 10 months ago.

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

100%

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

Duplicated by TYPO3 Core - Bug #80727: $className must be a non empty string Closed 2017-04-06

Associated revisions

Revision 21499a5a (diff)
Added by Christian Kuhn 10 months ago

[BUGFIX] Register FileBrowser for file_reference mode

Using the element browser for a type=group, internal_type=file_reference
TCA field leads to an exception due to a missing registration for
this mode. Register the file browser, similar to internal_type=file.

Resolves: #80541
Releases: master, 8.7
Change-Id: I54be7084f10d63ed262e903c296294589521f3df
Reviewed-on: https://review.typo3.org/58431
Reviewed-by: Markus Klein <>
Tested-by: Markus Klein <>
Reviewed-by: Wouter Wolters <>
Tested-by: TYPO3com <>
Reviewed-by: Anja Leichsenring <>
Tested-by: Anja Leichsenring <>

Revision 5ccb11cd (diff)
Added by Christian Kuhn 10 months ago

[BUGFIX] Register FileBrowser for file_reference mode

Using the element browser for a type=group, internal_type=file_reference
TCA field leads to an exception due to a missing registration for
this mode. Register the file browser, similar to internal_type=file.

Resolves: #80541
Releases: master, 8.7
Change-Id: I54be7084f10d63ed262e903c296294589521f3df
Reviewed-on: https://review.typo3.org/58435
Reviewed-by: Markus Klein <>
Tested-by: Markus Klein <>
Tested-by: TYPO3com <>

History

#1 Updated by Markus Klein over 2 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.

#2 Updated by Oliver Pfaff over 2 years ago

  • Duplicated by Bug #80727: $className must be a non empty string added

#3 Updated by Oliver Pfaff over 2 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.

#4 Updated by Claus Due about 2 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 ;)

#5 Updated by Tabea David about 2 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) {

#6 Updated by Markus Klein about 2 years ago

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

#7 Updated by Markus Klein about 2 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.

#8 Updated by Tobias Gülzow about 2 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

#9 Updated by Markus Klein about 2 years ago

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

#10 Updated by Markus Klein about 2 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

#11 Updated by Anja Leichsenring almost 2 years ago

  • Sprint Focus deleted (On Location Sprint)

#12 Updated by Kurt Gusbeth 11 months 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.

#13 Updated by Gerrit Code Review 10 months 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

#14 Updated by Gerrit Code Review 10 months 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

#15 Updated by Christian Kuhn 10 months ago

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

#16 Updated by Gerrit Code Review 10 months 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

#17 Updated by Gerrit Code Review 10 months 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

#18 Updated by Christian Kuhn 10 months ago

  • Status changed from Under Review to Resolved

#19 Updated by Benni Mack 10 months ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF