Project

General

Profile

Actions

Bug #102086

open

AdminPanel - Data variable leads to Error "could not be converted to string"

Added by Harald Holzmann 7 months ago. Updated 6 months ago.

Status:
New
Priority:
Should have
Assignee:
-
Category:
AdminPanel
Target version:
-
Start date:
2023-10-04
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
10
PHP Version:
7.2
Tags:
Complexity:
easy
Is Regression:
Sprint Focus:

Description

Hi,

when using the admin panel (it is activated), we got the error:

Object of class TYPO3\CMS\Core\Site\Entity\Site could not be converted to string in /var/www/html/vendor/typo3/cms-fluid/Classes/ViewHelpers/TranslateViewHelper.php line 147

I just looked into the issue and can give the following hint:
First we make the site available via typscript

page.10.dataProcessing {
  13 = TYPO3\CMS\Frontend\DataProcessing\SiteProcessor
  13 {
    as = site
  }
}

and now we have the variable available

  .....
  site => TYPO3\CMS\Core\Site\Entity\Siteprototypeobject
  .....

In the Partial of AdminPanel "Data\TableKeyValue.html" on line 28 the translate viewhelper is called with all data variables

<pre class="typo3-adminPanel-dump typo3-adminPanel-dump-{typeClass}"><f:if condition="{val} != ''"><f:translate key="{val}" default="{val}" extensionName="adminpanel" languageKey="{languageKey}"/></f:if></pre>

and then in TranslateViewHelper Line 147 the id should be parsed to string which causes the error

        if ((string)$id === '') {

Possible Solution:
a) Add toString method to Site-Object.
b) Because a user can add every type via dataprocessor there should be a general check the type of the data.

Thanks and best Regards,
Harald

Actions #1

Updated by Filipe DA COSTA COSTA 6 months ago

  • TYPO3 Version changed from 11 to 10
  • PHP Version changed from 8.2 to 7.2

Having the same issue.

With adminPanel active and if we assign a Domain Model to the view in the Sitepackags ContenController, we get the same:

PHP Catchable Fatal Error: Object of class TYPO3\CMS\Extbase\Mvc\Controller\ControllerContext could not be converted to string in /var/www/html/public/typo3/sysext/fluid/Classes/ViewHelpers/TranslateViewHelper.php line 147

Makes it difficult when interacting with repositories.

Edit: I'm sorry Harald Holzmann, I added my Typo3 version and it changed the version you tagged :(

Actions

Also available in: Atom PDF