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

Error 503 : ...GalleryItem::getImageReference(): Return value must be of type ...FileReference, null returned #55

Closed ymauray closed 11 months ago

ymauray commented 11 months ago

TYPO3 12.4.8 PHP 8.2.10

I have a gallery set to use a folder.

When I visit the page, I get an error 503 with the following error message :

Oops, an error occurred! FelixNagel\GenericGallery\Domain\Model\GalleryItem::getImageReference(): Return value must be of type TYPO3\CMS\Extbase\Domain\Model\FileReference, null returned

I was able to work around the problem by changing the signature of getImageReference from

public function getImageReference() : ExtbaseFileReference

to

public function getImageReference() : ExtbaseFileReference | null

but I'm not confident enought that this is the correct way to fix the problem, or if indeed there is a problem (could I have done something wrong elsewhere ?), so I have not send a pull request yet.

fnagel commented 11 months ago

Hey @ymauray, thanks for the bug report!

I was able to reproduce this, using a plugin in collection mode and the collection type is "folder". This is correct right?

Your fix look good. Seems like an issue with type hinting introduced a few commits ago.

I've pushed a fix, would you mind to test the latest master branch?

ymauray commented 11 months ago

Yes this was exactly my problem. I confirm the master branch fixes the problem. Thanks !

fnagel commented 11 months ago

Wonderful. Thanks for the feedback!

I've just released a version 6.0.1 containing the fix!