Issue Bug Closed

#107457ResourceFactory::getFileReferenceData(): Return value must be of type ?array, false returned

Ingo Hollmann 09/15/25, 06:36 updated 12/02/25, 13:04

Description

Calling: `TYPO3\CMS\Core\Resource\ResourceFactory::getFileReferenceData()` with an non existing File-Reference-Uid I get the Exception:

> TypeError: TYPO3\CMS\Core\Resource\ResourceFactory::getFileReferenceData(): Return value must be of type ?array, false returned, in file /home/hollmann/public_html/public/customer123/vendor/typo3/cms-core/Classes/Resource/ResourceFactory.php:464

The full stacktrace:

Stack trace:
#0 \/home\/hollmann\/public_html\/public\/customer123\/vendor\/typo3\/cms-core\/Classes\/Resource\/ResourceFactory.php(400): TYPO3\\CMS\\Core\\Resource\\ResourceFactory->getFileReferenceData()
#1 \/home\/hollmann\/public_html\/public\/customer123\/vendor\/typo3\/cms-core\/Classes\/Resource\/Filter\/FileExtensionFilter.php(60): TYPO3\\CMS\\Core\\Resource\\ResourceFactory->getFileReferenceObject()
#2 \/home\/hollmann\/public_html\/public\/customer123\/vendor\/typo3\/cms-core\/Classes\/DataHandling\/DataHandler.php(3242): TYPO3\\CMS\\Core\\Resource\\Filter\\FileExtensionFilter->filter()
#3 \/home\/hollmann\/public_html\/public\/customer123\/vendor\/typo3\/cms-core\/Classes\/DataHandling\/DataHandler.php(2594): TYPO3\\CMS\\Core\\DataHandling\\DataHandler->checkValue_file_processDBdata()
#4 \/home\/hollmann\/public_html\/public\/customer123\/vendor\/typo3\/cms-core\/Classes\/DataHandling\/DataHandler.php(1360): TYPO3\\CMS\\Core\\DataHandling\\DataHandler->checkValueForFile()
#5 \/home\/hollmann\/public_html\/public\/customer123\/vendor\/typo3\/cms-core\/Classes\/DataHandling\/DataHandler.php(1302): TYPO3\\CMS\\Core\\DataHandling\\DataHandler->checkValue_SW()
#6 \/home\/hollmann\/public_html\/public\/customer123\/vendor\/typo3\/cms-core\/Classes\/DataHandling\/DataHandler.php(1187): TYPO3\\CMS\\Core\\DataHandling\\DataHandler->checkValue()
#7 \/home\/hollmann\/public_html\/public\/customer123\/vendor\/typo3\/cms-core\/Classes\/DataHandling\/DataHandler.php(953): TYPO3\\CMS\\Core\\DataHandling\\DataHandler->fillInFieldArray()
#8 \/home\/hollmann\/public_html\/public\/typo3_ext\/myExtension\/Classes\/Libs\/Import.php(278): TYPO3\\CMS\\Core\\DataHandling\\DataHandler->process_datamap()
#9 \/home\/hollmann\/public_html\/public\/customer123\/vendor\/typo3\/cms-impexp\/Classes\/Import.php(419): MyVendor\\MyExtension\\Libs\\Import->setRelations()
#10 \/home\/hollmann\/public_html\/public\/typo3_ext\/myExtension\/Classes\/Services\/ImportService.php(245): TYPO3\\CMS\\Impexp\\Import->importData()
#11 \/home\/hollmann\/public_html\/public\/typo3_ext\/myExtension\/Classes\/Command\/TranslatorCommand.php(132): MyVendor\\MyExtension\\Services\\ImportService->import()
#12 \/home\/hollmann\/public_html\/public\/customer123\/vendor\/symfony\/console\/Command\/Command.php(318): MyVendor\\MyExtension\\Command\\TranslatorCommand->execute()
#13 \/home\/hollmann\/public_html\/public\/customer123\/vendor\/typo3\/cms-scheduler\/Classes\/Task\/ExecuteSchedulableCommandTask.php(100): Symfony\\Component\\Console\\Command\\Command->run()
#14 \/home\/hollmann\/public_html\/public\/customer123\/vendor\/typo3\/cms-scheduler\/Classes\/Scheduler.php(168): TYPO3\\CMS\\Scheduler\\Task\\ExecuteSchedulableCommandTask->execute()
#15 \/home\/hollmann\/public_html\/public\/customer123\/vendor\/typo3\/cms-scheduler\/Classes\/Command\/SchedulerCommand.php(252): TYPO3\\CMS\\Scheduler\\Scheduler->executeTask()
#16 \/home\/hollmann\/public_html\/public\/\/vendor\/typo3\/cms-scheduler\/Classes\/Command\/SchedulerCommand.php(183): TYPO3\\CMS\\Scheduler\\Command\\SchedulerCommand->executeOrStopTask()
#17 \/home\/hollmann\/public_html\/public\/customer123\/vendor\/typo3\/cms-scheduler\/Classes\/Command\/SchedulerCommand.php(117): TYPO3\\CMS\\Scheduler\\Command\\SchedulerCommand->loopTasks()
#18 \/home\/hollmann\/public_html\/public\/customer123\/vendor\/symfony\/console\/Command\/Command.php(318): TYPO3\\CMS\\Scheduler\\Command\\SchedulerCommand->execute()
#19 \/home\/hollmann\/public_html\/public\/customer123\/vendor\/symfony\/console\/Application.php(1110): Symfony\\Component\\Console\\Command\\Command->run()
#20 \/home\/hollmann\/public_html\/public\/customer123\/vendor\/symfony\/console\/Application.php(359): Symfony\\Component\\Console\\Application->doRunCommand()
#21 \/home\/hollmann\/public_html\/public\/customer123\/vendor\/symfony\/console\/Application.php(194): Symfony\\Component\\Console\\Application->doRun()
#22 \/home\/hollmann\/public_html\/public\/customer123\/vendor\/typo3\/cms-core\/Classes\/Console\/CommandApplication.php(113): Symfony\\Component\\Console\\Application->run()
#23 \/home\/hollmann\/public_html\/public\/customer123\/vendor\/typo3\/cms-cli\/typo3(23): TYPO3\\CMS\\Core\\Console\\CommandApplication->run()
#24 \/home\/hollmann\/public_html\/public\/customer123\/vendor\/typo3\/cms-cli\/typo3(24): {closure}()
#25 \/home\/hollmann\/public_html\/public\/customer123\/vendor\/bin\/typo3(119): include('...')
#26 {main}

It seems that there is indeed something that should be hardend.
https://git.typo3.org/typo3/typo3/-/blob/main/typo3/sysext/core/Classes/Resource/ResourceFactory.php#L420
As far as i know `->fetchAssociative()` can return `false`. Which wenn returned throws an type mismatch

Reviews 2