fnagel / generic-gallery

TYPO3 extension: Generic Gallery - One gallery to rule them all!
https://extensions.typo3.org/extension/generic_gallery/
GNU General Public License v3.0
7 stars 12 forks source link

[BUGFIX] Gracefully handle deleted image collection records (4.x) #47

Closed cweiske closed 8 months ago

cweiske commented 2 years ago

When a gallery content element is linked to a deleted image file collection, previewing it in the backend will lead to an exception:

(1/1) TypeError Argument 2 passed to TYPO3\CMS\Core\Imaging\IconFactory::getIconForRecord() must be of the type array, null given, called in typo3conf/ext/generic_gallery/Classes/Backend/Hooks/PageLayoutViewHook.php on line 251

Viewing the page in the frontend leads to a different error:

(1/1) #1314085992 InvalidArgumentException No collection found for given UID: "25" in typo3/sysext/core/Classes/Resource/ResourceFactory.php line 329

This patch fixes both exceptions by a) not rending the backend preview for the file collection record b) pretending there are no images to render in the frontend

This bug can be reproduced as follows:

  1. Create generic gallery content element
  2. In the element details, add image collection and provide a title
  3. Save the content element and close
  4. On the typo3 content element preview, click the collection icon. A context menu opens.
  5. Click "delete" and confirm
  6. Reload the typo3 backend page view
fnagel commented 1 year ago

Any reason there is no PR against master branch?

cweiske commented 1 year ago

We're using TYPO3 v10 and master does not work with it. But I'll open a new one.

fnagel commented 1 year ago

Wonderful, thank you. I will test this soon. Still working on PHP 8.1 compatibility for all my extensions...