hoogi91 / spreadsheets

TYPO3 Extension spreadsheets
https://extensions.typo3.org/extension/spreadsheets/
GNU General Public License v3.0
3 stars 5 forks source link

Add Typical page content in BE #269

Closed kdossantos98 closed 1 year ago

kdossantos98 commented 1 year ago

Version(s) affected: 3.3.0, TYPO3 11.5 BE

Description
When I try to add new Table(Excel Spreadsheets) content in the BE I get a warning message.

How to reproduce

  1. Go to the TYPO3 11.5 BE
  2. Create a new page
  3. Add new "Typical page content".
  4. Choose Table(Excel Spreadsheets)

Possible Solution
A hotfix for the problem is to add ?? null in the if statement in CellService.php line 43. It only fixes the warning message. if ($this->currentLocales === '' && is_int($GLOBALS['TSFE']->id ?? null)) {

Additional context
(1/1) #1476107295 TYPO3\CMS\Core\Error\Exception PHP Warning: Undefined global variable $TSFE in /var/www/html/htdocs/typo3conf/ext/spreadsheets/Classes/Service/CellService.php line 43

hoogi91 commented 1 year ago

Hey @kdossantos98,

thanks for the report I fixed this with version 3.3.1. Inside latest version 4.0.0 I had to rewrite the whole logic and thus do not use the globals variable anymore if you still want to participate from that language specific feature.

If you are migrating to the latest version please take a look into the code of https://github.com/hoogi91/spreadsheets/blob/develop/Classes/Service/CellService.php#L27 as I am currently forced to use the globals variable to fetch the request inside the service (see https://docs.typo3.org/m/typo3/reference-coreapi/main/en-us/ApiOverview/RequestLifeCycle/Typo3Request.html#last-resort-global-variable)

If there are any problems I might investigate a bit more time to get the request from one of the preferred aspects :)