lochmueller / focuspoint

🌅 Smartest TYPO3 Crop Tool ever 🌅
http://typo3.org/extensions/repository/view/focuspoint
22 stars 23 forks source link

PHP Exception in Filelist: „Could not fetch page data“ #108

Closed DanielHaring closed 10 months ago

DanielHaring commented 10 months ago

TL;DR

In certain circumstances an exception "Could not fetch page data for uid {sys_file_storage.uid}" is shown when browsing the Filelist.

This can be attributed to the fact that the Extbase LocalizationUtility is probably not intended for use outside of a page context.

I’ll provide a fix in no time.

The full story

When TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate() is used, Extbase fetches the current page to load the TypoScript setup. However, within Filelist there is no page and thus Extbase suddenly tries to load a page with the ID of the resource storage.

This works for most installations anyway, because usually a single resource storage with the ID "1" is used and also a page with the same ID exists, but leads to the above mentioned exception as soon as a corresponding page does not exist (e.g. because it was deleted).

My Installation

TYPO3 CMS v12.4.7 PHP v8.1.11 EXT:focuspoint v6.0.4

Steps to reproduce

  1. Create a fresh instance of TYPO3 CMS (v12.4.7 in my case) with EXT:focuspoint installed
  2. Create a single page in the page tree (ID: "1")
  3. Create an additional resource storage (ID: "2")
  4. Upload an image to both, the default resource storage and the newly created one
  5. Browse both storages within Filelist
  6. The default resource storage will work properly, while the second one will throw an exception
lochmueller commented 10 months ago

Thanks for the detailed explanation and the PR. Merged!